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:08:08 -0700
commit035fac5844e2cbc3bb485b6d274b4266c27aeeb2 (patch)
treeb6876b6b7c73ae7e54d43bfa96395e814b706413
parent4d3b4b41f4e2dbd884ea275a40d784a4fdd780fc (diff)
downloadlwn-035fac5844e2cbc3bb485b6d274b4266c27aeeb2.tar.gz
lwn-035fac5844e2cbc3bb485b6d274b4266c27aeeb2.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 87c06252d464..0ed436e3905e 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -281,8 +281,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");