drm/nouveau/mmu: qualify vmm during dtor
authorJon Derrick <jonathan.derrick@intel.com>
Sat, 16 Mar 2019 00:05:18 +0000 (18:05 -0600)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 1 May 2019 01:08:39 +0000 (11:08 +1000)
If the BAR initialization failed it may leave the vmm structure in an
unitialized state, leading to a null-pointer-dereference when the vmm is
dereferenced during teardown.

Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c

index fa93f964e6a4db0b5a8320cfc135921e33f4521b..41640e0584ac0fb02ede12b1c650267f8209d325 100644 (file)
@@ -1783,7 +1783,7 @@ nvkm_vmm_get(struct nvkm_vmm *vmm, u8 page, u64 size, struct nvkm_vma **pvma)
 void
 nvkm_vmm_part(struct nvkm_vmm *vmm, struct nvkm_memory *inst)
 {
-       if (inst && vmm->func->part) {
+       if (inst && vmm && vmm->func->part) {
                mutex_lock(&vmm->mutex);
                vmm->func->part(vmm, inst);
                mutex_unlock(&vmm->mutex);