Ilia Mirkin
2016-Sep-10  02:34 UTC
[Nouveau] [PATCH] fifo/nv04: avoid ramht race against cookie insertion
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Cc: stable at vger.kernel.org
---
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(+)
diff --git a/drm/nouveau/nvkm/engine/fifo/dmanv04.c
b/drm/nouveau/nvkm/engine/fifo/dmanv04.c
index edec30f..0a7b6ed 100644
--- a/drm/nouveau/nvkm/engine/fifo/dmanv04.c
+++ b/drm/nouveau/nvkm/engine/fifo/dmanv04.c
@@ -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
-- 
2.7.3
Ilia Mirkin
2016-Sep-28  00:03 UTC
[Nouveau] [PATCH] fifo/nv04: avoid ramht race against cookie insertion
On Fri, Sep 9, 2016 at 10:34 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu> > Cc: stable at vger.kernel.orgIan 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 Tested-by: Ian Romanick <idr at freedesktop.org>> --- > > 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(+) > > diff --git a/drm/nouveau/nvkm/engine/fifo/dmanv04.c b/drm/nouveau/nvkm/engine/fifo/dmanv04.c > index edec30f..0a7b6ed 100644 > --- a/drm/nouveau/nvkm/engine/fifo/dmanv04.c > +++ b/drm/nouveau/nvkm/engine/fifo/dmanv04.c > @@ -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 > -- > 2.7.3 >
Apparently Analagous Threads
- [PATCH] drm/nouveau: fix ramht wraparound
- [PATCH] core: use vzalloc for allocating ramht
- [Mesa-dev] [PATCH 2/2] docs: mark ARB_texture_gather as done on nvc0
- [PATCH 1/2] drm/nv04: Fix NV04 set_operation software method.
- [PATCH 1/3] drm/nv50: include vp in the fb error reporting mask