Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3693d544 authored by Samuel Pitoiset's avatar Samuel Pitoiset Committed by Ben Skeggs
Browse files

drm/nouveau/pm: prevent freeing the wrong engine context



This fixes a crash when multiple PM engine contexts are created.

Signed-off-by: default avatarSamuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: default avatarMartin Peres <martin.peres@free.fr>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 4a8cf451
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -332,8 +332,11 @@ 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);
	nvkm_engctx_destroy(&ctx->base);
	if (ppm->context == ctx)
		ppm->context = NULL;
	mutex_unlock(&nv_subdev(ppm)->mutex);
}