summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKamil Dudka <kdudka@redhat.com>2015-07-15 22:57:43 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-08-10 12:21:59 -0700
commit58e8dcc3d24e8115e8d0d988c8a0c68992a1c8fb (patch)
tree77b7c131fdb2754f8dfb1c1ff9349724e7f2c4b1
parent53f092abcba808c59ae9d4744175e9c25287a81c (diff)
downloadlinux-stable-58e8dcc3d24e8115e8d0d988c8a0c68992a1c8fb.tar.gz
linux-stable-58e8dcc3d24e8115e8d0d988c8a0c68992a1c8fb.tar.bz2
linux-stable-58e8dcc3d24e8115e8d0d988c8a0c68992a1c8fb.zip
drm/nouveau/drm/nv04-nv40/instmem: protect access to priv->heap by mutex
commit 7512223b1ece29a5968ed8b67ccb891d21b7834b upstream. This fixes the list_del corruption reported at <https://bugzilla.redhat.com/1205985>. Signed-off-by: Kamil Dudka <kdudka@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv04.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv04.c b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv04.c
index 80614f1b2074..282143f49d72 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv04.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv04.c
@@ -50,7 +50,12 @@ nv04_instobj_dtor(struct nvkm_object *object)
{
struct nv04_instmem_priv *priv = (void *)nvkm_instmem(object);
struct nv04_instobj_priv *node = (void *)object;
+ struct nvkm_subdev *subdev = (void *)priv;
+
+ mutex_lock(&subdev->mutex);
nvkm_mm_free(&priv->heap, &node->mem);
+ mutex_unlock(&subdev->mutex);
+
nvkm_instobj_destroy(&node->base);
}
@@ -62,6 +67,7 @@ nv04_instobj_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nv04_instmem_priv *priv = (void *)nvkm_instmem(parent);
struct nv04_instobj_priv *node;
struct nvkm_instobj_args *args = data;
+ struct nvkm_subdev *subdev = (void *)priv;
int ret;
if (!args->align)
@@ -72,8 +78,10 @@ nv04_instobj_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
if (ret)
return ret;
+ mutex_lock(&subdev->mutex);
ret = nvkm_mm_head(&priv->heap, 0, 1, args->size, args->size,
args->align, &node->mem);
+ mutex_unlock(&subdev->mutex);
if (ret)
return ret;