summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Slusarz <marcin.slusarz@gmail.com>2011-08-22 21:17:57 +0000
committerGreg Kroah-Hartman <gregkh@suse.de>2011-08-29 14:33:02 -0700
commitaf0f7f669e9cb671422111246d71c37f5d18252c (patch)
treef76ec0cc222ab8bd2a8d6a65147b0eadc073bfbb
parent9792fdb75682aeb0d23365adf8bc4e2d7a8cb97e (diff)
downloadlwn-af0f7f669e9cb671422111246d71c37f5d18252c.tar.gz
lwn-af0f7f669e9cb671422111246d71c37f5d18252c.zip
drm/ttm: fix ttm_bo_add_ttm(user) failure path
commit 7c4c3960dff109bc5db4c35da481c212dadb5eb5 upstream. ttm_tt_destroy kfrees passed object, so we need to nullify a reference to it. Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index acbfa27bc6f3..94706eff60d7 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -343,8 +343,10 @@ static int ttm_bo_add_ttm(struct ttm_buffer_object *bo, bool zero_alloc)
ret = ttm_tt_set_user(bo->ttm, current,
bo->buffer_start, bo->num_pages);
- if (unlikely(ret != 0))
+ if (unlikely(ret != 0)) {
ttm_tt_destroy(bo->ttm);
+ bo->ttm = NULL;
+ }
break;
default:
printk(KERN_ERR TTM_PFX "Illegal buffer object type\n");