drm/radeon: use after free in radeon_vm_bo_add()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 9 Jan 2012 12:44:50 +0000 (15:44 +0300)
committerDave Airlie <airlied@redhat.com>
Mon, 9 Jan 2012 12:49:21 +0000 (12:49 +0000)
"bo_va" is dereferenced in the error message.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/radeon/radeon_gart.c

index 8597d2c016e672fd2b127464a8adbd4285616276..a97baf5c114fa5f8304d636e5208b9f5577ef519 100644 (file)
@@ -494,10 +494,10 @@ int radeon_vm_bo_add(struct radeon_device *rdev,
                }
                if (bo_va->soffset >= tmp->soffset && bo_va->soffset < tmp->eoffset) {
                        /* bo and tmp overlap, invalid offset */
-                       kfree(bo_va);
                        dev_err(rdev->dev, "bo %p va 0x%08X conflict with (bo %p 0x%08X 0x%08X)\n",
                                bo, (unsigned)bo_va->soffset, tmp->bo,
                                (unsigned)tmp->soffset, (unsigned)tmp->eoffset);
+                       kfree(bo_va);
                        mutex_unlock(&vm->mutex);
                        return -EINVAL;
                }