Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] drm/display: missing lock and clear in drm_connector_hdmi_cec_unregister() --
commit 6c19735a9b5d351aeeed042f0b7e6649c04d3e13 Author: Luca Ceresoli <[email protected]> drm/display: hdmi-cec-helper: add non-drmm API variant This commit adds non-drmm drm_connector_hdmi_cec_register() and drm_connector_hdmi_cec_unregister() helpers to support hotpluggable HDMI bridges. > diff --git a/drivers/gpu/drm/display/drm_hdmi_cec_helper.c > b/drivers/gpu/drm/display/drm_hdmi_cec_helper.c > index b79c41703d539..81b271659ad9c 100644 > --- a/drivers/gpu/drm/display/drm_hdmi_cec_helper.c > +++ b/drivers/gpu/drm/display/drm_hdmi_cec_helper.c [ ... ] > @@ -160,6 +150,38 @@ int drmm_connector_hdmi_cec_register(struct > drm_connector *connector, > > return ret; > } > +EXPORT_SYMBOL(drm_connector_hdmi_cec_register); > + > +void drm_connector_hdmi_cec_unregister(struct drm_connector *connector) > +{ > + struct drm_connector_hdmi_cec_data *data = connector->cec.data; > + > + cec_unregister_adapter(data->adapter); > + > + if (data->funcs->uninit) > + data->funcs->uninit(connector); > + > + kfree(data); > + connector->cec.data = NULL; > +} > +EXPORT_SYMBOL(drm_connector_hdmi_cec_unregister); [Severity: High] Does drm_connector_hdmi_cec_unregister() need to hold connector->cec.mutex and clear connector->cec.funcs? drm_connector_cec_phys_addr_invalidate() and drm_connector_cec_phys_addr_set() serialize on connector->cec.mutex and check only connector->cec.funcs before invoking the callback, which then dereferences connector->cec.data->adapter. Because drm_connector_hdmi_cec_unregister() frees data without holding connector->cec.mutex and leaves connector->cec.funcs populated while connector->cec.data is NULL, a concurrent or subsequent hotplug path such as drm_atomic_helper_connector_hdmi_hotplug() can trigger a use-after-free or NULL pointer dereference on data. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=2
