drm/nouveau/fifo/nv04: avoid ramht race against cookie insertion
authorIlia Mirkin <imirkin@alum.mit.edu>
Sat, 10 Sep 2016 02:34:02 +0000 (22:34 -0400)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 22 Sep 2016 07:32:20 +0000 (17:32 +1000)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: stable@vger.kernel.org
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv04.c

index edec30fd3ecd682174acab05f15f0cd18db68331..0a7b6ed5ed284fc56fa518dceb9ae050643cce60 100644 (file)
@@ -37,7 +37,10 @@ nv04_fifo_dma_object_dtor(struct nvkm_fifo_chan *base, int cookie)
 {
        struct nv04_fifo_chan *chan = nv04_fifo_chan(base);
        struct nvkm_instmem *imem = chan->fifo->base.engine.subdev.device->imem;
+
+       mutex_lock(&chan->fifo->base.engine.subdev.mutex);
        nvkm_ramht_remove(imem->ramht, cookie);
+       mutex_unlock(&chan->fifo->base.engine.subdev.mutex);
 }
 
 static int