]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drm/ttm: fix ttm_bo_add_ttm(user) failure path
authorMarcin Slusarz <marcin.slusarz@gmail.com>
Mon, 22 Aug 2011 21:17:57 +0000 (21:17 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 29 Aug 2011 20:29:15 +0000 (13:29 -0700)
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>
drivers/gpu/drm/ttm/ttm_bo.c

index 2e618b5ac465de3bb83348c2791becbc43d04bac..b7f0726645ad3ea96241326bfc39d2ea608385a7 100644 (file)
@@ -353,8 +353,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");