Hello,

On 3/27/26 08:55, Cristian Ciocaltea wrote:
The DisplayPort AUX channel gets initialized and registered during
dw_dp_bind(), but it is never unregistered, which may lead to resource
leaks and/or use-after-free.

Add the missing dw_dp_unbind() function to allow the users of the
library to handle the required cleanup, i.e. unregister the AUX adapter.

Fixes: 86eecc3a9c2e ("drm/bridge: synopsys: Add DW DPTX Controller support 
library")
Signed-off-by: Cristian Ciocaltea <[email protected]>

   Reviewed-by: Andy Yan <[email protected]>

Thanks.
---
  drivers/gpu/drm/bridge/synopsys/dw-dp.c | 6 ++++++
  include/drm/bridge/dw_dp.h              | 1 +
  2 files changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-dp.c 
b/drivers/gpu/drm/bridge/synopsys/dw-dp.c
index 3f4530c117c7..6211ba6ba7bd 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-dp.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-dp.c
@@ -2093,6 +2093,12 @@ struct dw_dp *dw_dp_bind(struct device *dev, struct 
drm_encoder *encoder,
  }
  EXPORT_SYMBOL_GPL(dw_dp_bind);
+void dw_dp_unbind(struct dw_dp *dp)
+{
+       drm_dp_aux_unregister(&dp->aux);
+}
+EXPORT_SYMBOL_GPL(dw_dp_unbind);
+
  MODULE_AUTHOR("Andy Yan <[email protected]>");
  MODULE_DESCRIPTION("DW DP Core Library");
  MODULE_LICENSE("GPL");
diff --git a/include/drm/bridge/dw_dp.h b/include/drm/bridge/dw_dp.h
index 25363541e69d..22105c3e8e4d 100644
--- a/include/drm/bridge/dw_dp.h
+++ b/include/drm/bridge/dw_dp.h
@@ -24,4 +24,5 @@ struct dw_dp_plat_data {
struct dw_dp *dw_dp_bind(struct device *dev, struct drm_encoder *encoder,
                         const struct dw_dp_plat_data *plat_data);
+void dw_dp_unbind(struct dw_dp *dp);
  #endif /* __DW_DP__ */


Reply via email to