From 753512085975e8b4d499df0aadb7b1215265ec5e Mon Sep 17 00:00:00 2001 From: Volodymyr Babchuk Date: Fri, 5 Jan 2018 21:15:36 +0200 Subject: [PATCH] [HACK?]rcar_du_vs: zero-out sg_tables on plane duplication Zero-out sg_tables in original plane, efectively introducing move semantic. Seems, this fixes issue with double-free, when rcar_du_vsp_plane_cleanup_fb() freed the same sg_table both in original plane and in the copy. Signed-off-by: Volodymyr Babchuk Reviewed-by: Oleksandr Andrushchenko --- drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c index 710ffd48846670..509c995c5819a8 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c @@ -351,6 +351,8 @@ rcar_du_vsp_plane_atomic_duplicate_state(struct drm_plane *plane) if (copy == NULL) return NULL; + memset(state->sg_tables, 0, sizeof(state->sg_tables)); + __drm_atomic_helper_plane_duplicate_state(plane, ©->state); return ©->state;