drm/bridge: properly refcount DT nodes in aux bridge drivers
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Sat, 16 Dec 2023 23:59:10 +0000 (01:59 +0200)
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Tue, 19 Dec 2023 00:06:16 +0000 (02:06 +0200)
commit6914968a0b52507bf19d85e5fb9e35272e17cd35
tree7c1bd8914b5449a3236f5f2eb692ec54a9d53451
parent8a53e29fe05c56f643eaab285f224c09b9c3dd4c
drm/bridge: properly refcount DT nodes in aux bridge drivers

The aux-bridge and aux-hpd-bridge drivers didn't call of_node_get() on
the device nodes further used for dev->of_node and platform data. When
bridge devices are released, the reference counts are decreased,
resulting in refcount underflow / use-after-free warnings. Get
corresponding refcounts during AUX bridge allocation.

Reported-by: Luca Weiss <luca.weiss@fairphone.com>
Fixes: 2a04739139b2 ("drm/bridge: add transparent bridge helper")
Fixes: 26f4bac3d884 ("drm/bridge: aux-hpd: Replace of_device.h with explicit include")
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20231216235910.911958-1-dmitry.baryshkov@linaro.org
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
drivers/gpu/drm/bridge/aux-bridge.c
drivers/gpu/drm/bridge/aux-hpd-bridge.c