summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom-at-vmware-dot-com>2009-03-23 08:53:28 +0100
committerThomas Hellstrom <thellstrom-at-vmware-dot-com>2009-03-23 08:56:53 +0100
commit7f38882b15dd048b1453123526fcb0e2d27c01a8 (patch)
treed96804ce813d23065fb9633ea5ae1cb4e58e3dad
parentb771b6a6c3f4a92ccfc2ad427cb2cb11a47cdfd1 (diff)
ttm: Clear the bo->vm_node pointer
a) When the vm_node is freed in ttm_bo.c b) When we transfer a buffer object in ttm_bo_util.c Reported by Jerome Glisse.
-rw-r--r--linux-core/ttm/ttm_bo.c1
-rw-r--r--linux-core/ttm/ttm_bo_util.c8
2 files changed, 8 insertions, 1 deletions
diff --git a/linux-core/ttm/ttm_bo.c b/linux-core/ttm/ttm_bo.c
index 22ab75f3..b3eeea01 100644
--- a/linux-core/ttm/ttm_bo.c
+++ b/linux-core/ttm/ttm_bo.c
@@ -517,6 +517,7 @@ static void ttm_bo_release(struct kref *kref)
if (likely(bo->vm_node != NULL)) {
rb_erase(&bo->vm_rb, &bdev->addr_space_rb);
drm_mm_put_block(bo->vm_node);
+ bo->vm_node = NULL;
}
write_unlock(&bdev->vm_lock);
ttm_bo_cleanup_refs(bo, false);
diff --git a/linux-core/ttm/ttm_bo_util.c b/linux-core/ttm/ttm_bo_util.c
index 598c2b92..72e67b57 100644
--- a/linux-core/ttm/ttm_bo_util.c
+++ b/linux-core/ttm/ttm_bo_util.c
@@ -285,13 +285,19 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
return -ENOMEM;
*fbo = *bo;
+
+ /**
+ * Fix up members that we shouldn't copy directly:
+ * TODO: Explicit member copy would probably be better here.
+ */
+
mutex_init(&fbo->mutex);
mutex_lock(&fbo->mutex);
-
init_waitqueue_head(&fbo->event_queue);
INIT_LIST_HEAD(&fbo->ddestroy);
INIT_LIST_HEAD(&fbo->lru);
INIT_LIST_HEAD(&fbo->swap);
+ fbo->vm_node = NULL;
fbo->sync_obj = driver->sync_obj_ref(bo->sync_obj);
if (fbo->mem.mm_node)