diff options
author | Samuel Pitoiset <samuel.pitoiset@gmail.com> | 2015-06-07 22:40:11 +0200 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2015-07-27 18:56:09 +1000 |
commit | 3693d544056b822f7f2454da5acb7eda9471b902 (patch) | |
tree | 64bbaeca41c00c8b52a05584af00d873f2ca1514 | |
parent | 4a8cf4513dd4279d342eb41abdb9db65285732b3 (diff) | |
download | op-kernel-dev-3693d544056b822f7f2454da5acb7eda9471b902.zip op-kernel-dev-3693d544056b822f7f2454da5acb7eda9471b902.tar.gz |
drm/nouveau/pm: prevent freeing the wrong engine context
This fixes a crash when multiple PM engine contexts are created.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c index 2006c44..274457c 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c @@ -332,9 +332,12 @@ static void nvkm_perfctx_dtor(struct nvkm_object *object) { struct nvkm_pm *ppm = (void *)object->engine; + struct nvkm_perfctx *ctx = (void *)object; + mutex_lock(&nv_subdev(ppm)->mutex); - nvkm_engctx_destroy(&ppm->context->base); - ppm->context = NULL; + nvkm_engctx_destroy(&ctx->base); + if (ppm->context == ctx) + ppm->context = NULL; mutex_unlock(&nv_subdev(ppm)->mutex); } |