Skip to contentSkip to conversation

fifo/nv04: avoid ramht race against cookie insertion

PATCH In review Ilia Mirkin 1 participant 2 messages Sep 10, 2016 – Sep 28, 2016 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fifo/nv04: avoid ramht race against cookie insertion

---

Ian Romanick reported a kernel crash that implicated this path in a null pointer jump, which means that one of the function pointers had been nulled out. Not sure if a race there would explain it, but maybe.

There is also questionable ramht usage in channv50 and various disp code. If you think this is a good idea, those should probably be fixed up as well.

 drm/nouveau/nvkm/engine/fifo/dmanv04.c | 3 +++
 1 file changed, 3 insertions(+)
drm/nouveau/nvkm/engine/fifo/dmanv04.c +3 -0
index edec30f..0a7b6ed 100644
@@ -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
Signature · 6 lines
2.7.3

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): 1473474842-6901-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/[email protected]

author Tested-by Ian Romanick
#2 lore raw
Quoted 2 lines · Ilia Mirkin

Ian mentioned that he tested this out on IRC:

#dri-devel: <idr> imirkin: Your patch to the nouveau kernel module fixes the oops that I encountered. Consider that a Tested-by.

So you can probably throw in a

Quoted 28 lines

---

Ian Romanick reported a kernel crash that implicated this path in a null pointer jump, which means that one of the function pointers had been nulled out. Not sure if a race there would explain it, but maybe.

There is also questionable ramht usage in channv50 and various disp code. If you think this is a good idea, those should probably be fixed up as well.

 drm/nouveau/nvkm/engine/fifo/dmanv04.c | 3 +++
 1 file changed, 3 insertions(+)
drm/nouveau/nvkm/engine/fifo/dmanv04.c +3 -1
index edec30f..0a7b6ed 100644
@@ -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
--
Quoted 2 lines

2.7.3

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau