[PATCH 4.4 07/93] drm/nouveau/fifo/nv04: avoid ramht race against cookie insertion

From: Greg Kroah-Hartman
Date: Thu Oct 06 2016 - 04:55:20 EST


4.4-stable review patch. If anyone has any objections, please let me know.

------------------

From: Ilia Mirkin <imirkin@xxxxxxxxxxxx>

commit 666ca3d8f19082f40745d75f3cc7cc0200ee87e3 upstream.

Signed-off-by: Ilia Mirkin <imirkin@xxxxxxxxxxxx>
Signed-off-by: Ben Skeggs <bskeggs@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv04.c | 3 +++
1 file changed, 3 insertions(+)

--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv04.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/dmanv04.c
@@ -36,7 +36,10 @@ nv04_fifo_dma_object_dtor(struct nvkm_fi
{
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