diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2023-05-25 10:31:05 +1000 |
---|---|---|
committer | Karol Herbst <kherbst@redhat.com> | 2023-07-06 17:22:33 +0200 |
commit | c1e854a3e3fda82a0bf567c2f00bfc4f9b0fb147 (patch) | |
tree | b421d4d118f4e85345c32a01822f925ee2e71af5 /drivers/gpu/drm/nouveau/nvif/mmu.c | |
parent | 55e1a5996085513aa2a484ff643ac2bc4b1ff5d6 (diff) |
drm/nouveau/nvif: fix potential double-free
DRM cleanup paths unconditionally call nvif_mmu_dtor() for clients,
which would result in a double-free if nvif_mmu_ctor()'d previously
failed.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230525003106.3853741-9-skeggsb@gmail.com
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvif/mmu.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nvif/mmu.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nvif/mmu.c b/drivers/gpu/drm/nouveau/nvif/mmu.c index 3709cbbc19a1..c9dd3cff49a0 100644 --- a/drivers/gpu/drm/nouveau/nvif/mmu.c +++ b/drivers/gpu/drm/nouveau/nvif/mmu.c @@ -27,6 +27,9 @@ void nvif_mmu_dtor(struct nvif_mmu *mmu) { + if (!nvif_object_constructed(&mmu->object)) + return; + kfree(mmu->kind); kfree(mmu->type); kfree(mmu->heap); |