sna: Only couple up a proxy->rq when inserting into the request->buffers list
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 12 Mar 2014 12:17:55 +0000 (12:17 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Wed, 12 Mar 2014 12:23:53 +0000 (12:23 +0000)
Otherwise, we may never decouple it again afterwards leading to a
dangling pointer dereference.

Bugzilla: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1289923
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
src/sna/kgem.c
src/sna/kgem.h

index 8aef623..729573a 100644 (file)
@@ -5841,11 +5841,13 @@ struct kgem_bo *kgem_create_proxy(struct kgem *kgem,
        bo->proxy = kgem_bo_reference(target);
        bo->delta = offset;
 
+       /* Proxies are only tracked for busyness on the current rq */
        if (target->exec && !bo->io) {
+               assert(RQ(target->rq) == kgem->next_request);
                list_move_tail(&bo->request, &kgem->next_request->buffers);
                bo->exec = &_kgem_dummy_exec;
+               bo->rq = target->rq;
        }
-       bo->rq = target->rq;
 
        return bo;
 }
index fdabd50..cb0055e 100644 (file)
@@ -630,6 +630,8 @@ static inline void __kgem_bo_mark_dirty(struct kgem_bo *bo)
             bo->handle, bo->proxy != NULL));
 
        assert(bo->refcnt);
+       assert(bo->exec);
+       assert(bo->rq);
 
        bo->exec->flags |= LOCAL_EXEC_OBJECT_WRITE;
        bo->needs_flush = bo->gpu_dirty = true;