drm/nouveau/gk20a: fix NULL dereference on allocation failure
Subsystems (5)
PATCH 1/1 drm/nouveau/gk20a: fix NULL dereference on allocation failure
If memory allocation fails, node->base.imem does not get populated, causing a NULL pointer dereference on instobj destruction. Fix this by dereferencing it only if the allocation was successful.
Signed-off-by Mikko Perttunen <[email protected]>
--- drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c +2 -2
@@ -296,12 +296,12 @@ gk20a_instobj_dtor_dma(struct nvkm_memory *memory) {struct gk20a_instobj_dma *node =gk20a_instobj_dma (memory);struct gk20a_instmem *imem = node->base.imem; -struct device *dev = imem->base.subdev.device->dev;if (unlikely (!node->base.vaddr)) goto out; -dma_free_attrs (dev, (u64 )node->base.mn->length <<PAGE_SHIFT , +dma_free_attrs (imem->base.subdev.device->dev, + (u64 )node->base.mn->length <<PAGE_SHIFT , node->base.vaddr, node->handle, imem->attrs); out:
Signature · 1 line
2.30.1