[PATCH 1/4] drm/fb-helper: Fix connector ref leak on error

ville.syrjala at linux.intel.com ville.syrjala at linux.intel.com
Wed Oct 26 09:05:52 UTC 2016


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

We need to drop the connector references already taken when we
abort in the middle of drm_fb_helper_single_add_all_connectors()

Cc: stable at vger.kernel.org
Cc: Carlos Santa <carlos.santa at intel.com>
Cc: Kirill A. Shutemov <kirill at shutemov.name>
Tested-by: Carlos Santa <carlos.santa at intel.com>
Tested-by: Kirill A. Shutemov <kirill at shutemov.name>
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 drivers/gpu/drm/drm_fb_helper.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 83dbae0fabcf..db469d12d195 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -131,7 +131,12 @@ int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper)
 	return 0;
 fail:
 	for (i = 0; i < fb_helper->connector_count; i++) {
-		kfree(fb_helper->connector_info[i]);
+		struct drm_fb_helper_connector *fb_helper_connector =
+			fb_helper->connector_info[i];
+
+		drm_connector_unreference(fb_helper_connector->connector);
+
+		kfree(fb_helper_connector);
 		fb_helper->connector_info[i] = NULL;
 	}
 	fb_helper->connector_count = 0;
-- 
2.7.4



More information about the dri-devel mailing list