From c848d00bd43c47e7f11724330380e0c68ec7ae5e Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 9 Nov 2009 22:01:52 +0100 Subject: Fix oops in GEM object allocation If the allocation of a new GEM object failed due to there being no available VRAM, then glamo_gem_object_alloc() would bail out, calling drm_gem_object_unreference() in the process. glamodrm_gem_free_object() would then proceed to try to give back the memory which was unsuccessfully allocated. This obviously doesn't work, and resulted in an oops. To fix it, check that the VRAM block handle is non-NULL before freeing it. Signed-off-by: Thomas White --- drivers/mfd/glamo/glamo-buffer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/glamo/glamo-buffer.c b/drivers/mfd/glamo/glamo-buffer.c index e1c973c66af..a6d085f3303 100644 --- a/drivers/mfd/glamo/glamo-buffer.c +++ b/drivers/mfd/glamo/glamo-buffer.c @@ -319,7 +319,9 @@ void glamodrm_gem_free_object(struct drm_gem_object *obj) gobj = obj->driver_private; /* Free the VRAM */ - drm_mm_put_block(gobj->block); + if ( gobj->block != NULL ) { + drm_mm_put_block(gobj->block); + } /* Release mappings */ list = &obj->map_list; -- cgit v1.2.3