drm: omapdrm: gem: Free the correct memory object
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Mon, 14 Dec 2015 20:39:38 +0000 (22:39 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Thu, 31 Dec 2015 09:25:45 +0000 (11:25 +0200)
The GEM object free handler frees memory allocated by the driver using
the pointer to the drm_gem_object instead of the pointer to the
omap_gem_object that embeds it. This doesn't cause any issue in practice
as the drm_gem_object is the first field of omap_gem_object, but would
cause memory corruption if the structure layout changes. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/gpu/drm/omapdrm/omap_gem.c

index 391bc73..d9ce296 100644 (file)
@@ -1345,7 +1345,7 @@ void omap_gem_free_object(struct drm_gem_object *obj)
 
        drm_gem_object_release(obj);
 
-       kfree(obj);
+       kfree(omap_obj);
 }
 
 /* GEM buffer object constructor */