diff mbox series

[BACKPORT,v4.19,3/3] drm/nouveau/mmu: qualify vmm during dtor

Message ID 20200121202828.16590-4-sushmax.kalakota@intel.com
State New
Headers show
Series [BACKPORT,v4.19,1/3] drm/nouveau/bar/nv50: check bar1 vmm return value | expand

Commit Message

Sushma Kalakota Jan. 21, 2020, 8:28 p.m. UTC
From: Jon Derrick <jonathan.derrick@intel.com>

commit 15516bf9abaa41421a6ded79a5a2fee86f9594e5 upstream

This fix is a case where a nv50 or gf100 graphics card is used on a VMD
Domain that results in a null-pointer dereference.

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>
Signed-off-by: Sushma Kalakota <sushmax.kalakota@intel.com>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c
index 7459def78d50..5f8b8b399b97 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c
@@ -1423,7 +1423,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);