drm: i915: fix a possible refcount leak in intel_dp_add_mst_connector()
Subsystems (3)
PATCH RESEND 1/1 drm: i915: fix a possible refcount leak in intel_dp_add_mst_connector()
If drm_connector_init fails, intel_connector_free will be called to take care of proper free. So it is necessary to drop the refcount of port before intel_connector_free.
--- drivers/gpu/drm/i915/display/intel_dp_mst.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/display/intel_dp_mst.c +1 -0
@@ -839,6 +839,7 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo ret =drm_connector_init (dev, connector, &intel_dp_mst_connector_funcs, DRM_MODE_CONNECTOR_DisplayPort);if (ret) { +drm_dp_mst_put_port_malloc (port);intel_connector_free (intel_connector);return NULL ; }
Signature · 1 line
2.25.1
Hi Hangyu
Don't know why but our CI still did not caught this patch.
Maybe it is because [email protected] needs to be in the "to" list, try that in future patches.
Anyways I have resend it and it is properly behaving now.
https://patchwork.freedesktop.org/series/105601/
After CI results I will push this for you.
Quoted 23 lines · Hangyu Hua
If
drm_connector_initfails,intel_connector_freewill be called to take care of proper free. So it is necessary to drop the refcount of port beforeintel_connector_free.Fixes 091a4f91942a ("drm/i915: Handle drm-layer errors in intel_dp_add_mst_connector")Signed-off-by Hangyu Hua <[email protected]>Reviewed-by José Roberto de Souza <[email protected]>--- drivers/gpu/drm/i915/display/intel_dp_mst.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/i915/display/intel_dp_mst.c +1
-0@@ -839,6 +839,7 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo ret =drm_connector_init (dev, connector, &intel_dp_mst_connector_funcs, DRM_MODE_CONNECTOR_DisplayPort);if (ret) { +drm_dp_mst_put_port_malloc (port);intel_connector_free (intel_connector);return NULL ; }
Nice catch!
Will push to drm-intel-next
Quoted 27 lines · Hangyu Hua
If
drm_connector_initfails,intel_connector_freewill be called to take care of proper free. So it is necessary to drop the refcount of port beforeintel_connector_free.Fixes 091a4f91942a ("drm/i915: Handle drm-layer errors in
intel_dp_add_mst_connector")Signed-off-by Hangyu Hua <[email protected]>Reviewed-by José Roberto de Souza <[email protected]>---
drivers/gpu/drm/i915/display/intel_dp_mst.c | 1 +1 file changed, 1 insertion(+)drivers/gpu/drm/i915/display/intel_dp_mst.c +1
-0@@ -839,6 +839,7 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo ret = drm_connector_init(dev, connector, &intel_dp_mst_connector_funcs, DRM_MODE_CONNECTOR_DisplayPort); if (ret) { + drm_dp_mst_put_port_malloc(port); intel_connector_free(intel_connector);return NULL;
}
Signature · 3 lines
Cheers, Lyude Paul (she/her) Software Engineer at Red Hat
Ah-nevermind! Seems like someone already pushed this for you :)
Quoted 35 lines · Lyude Paul
Nice catch!
Reviewed-by Lyude Paul <[email protected]>Will push to drm-intel-next
Quoted 27 lines · Hangyu Hua
If
drm_connector_initfails,intel_connector_freewill be called to take care of proper free. So it is necessary to drop the refcount of port beforeintel_connector_free.Fixes 091a4f91942a ("drm/i915: Handle drm-layer errors in
intel_dp_add_mst_connector")Signed-off-by Hangyu Hua <[email protected]>Reviewed-by José Roberto de Souza <[email protected]>---
drivers/gpu/drm/i915/display/intel_dp_mst.c | 1 +1 file changed, 1 insertion(+)drivers/gpu/drm/i915/display/intel_dp_mst.c +1
-0@@ -839,6 +839,7 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo ret = drm_connector_init(dev, connector, &intel_dp_mst_connector_funcs, DRM_MODE_CONNECTOR_DisplayPort); if (ret) { + drm_dp_mst_put_port_malloc(port); intel_connector_free(intel_connector);return NULL;
}
Signature · 3 lines
Cheers, Lyude Paul (she/her) Software Engineer at Red Hat