drm/fb-helper: Fix connector ref leak on error
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 26 Oct 2016 09:05:52 +0000 (12:05 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 26 Oct 2016 12:41:40 +0000 (14:41 +0200)
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@vger.kernel.org
Cc: Carlos Santa <carlos.santa@intel.com>
Cc: Kirill A. Shutemov <kirill@shutemov.name>
Tested-by: Carlos Santa <carlos.santa@intel.com>
Tested-by: Kirill A. Shutemov <kirill@shutemov.name>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1477472755-15288-2-git-send-email-ville.syrjala@linux.intel.com
drivers/gpu/drm/drm_fb_helper.c

index aae7df01864d2537c0c1d003d75338e1398782c7..efaccc2e1b4ca8335514797b045898eecc5e7b5b 100644 (file)
@@ -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;