drm: rcar-du: Fix framebuffer reference leak through plane state
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Thu, 5 Mar 2015 17:41:04 +0000 (19:41 +0200)
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Thu, 19 Mar 2015 10:00:21 +0000 (12:00 +0200)
Plane state duplication takes a reference to the framebuffer stored in
the state, but state destroy doesn't release it. This causes a reference
leak. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
drivers/gpu/drm/rcar-du/rcar_du_plane.c

index 35a2f04ab799a9afe78fb6de14d10b04c645d1d5..210e5c3fd9820d30f3347ce01fb4ecbb8b9f5fe5 100644 (file)
@@ -316,6 +316,9 @@ rcar_du_plane_atomic_duplicate_state(struct drm_plane *plane)
 static void rcar_du_plane_atomic_destroy_state(struct drm_plane *plane,
                                               struct drm_plane_state *state)
 {
+       if (state->fb)
+               drm_framebuffer_unreference(state->fb);
+
        kfree(to_rcar_du_plane_state(state));
 }