Skip to content

Commit 7d9110e

Browse files
Fanhua Ligregkh
authored andcommitted
drm/nouveau/nvif: Fix potential memory leak in nvif_vmm_ctor().
[ Upstream commit bb8aeaa ] When the nvif_vmm_type is invalid, we will return error directly without freeing the args in nvif_vmm_ctor(), which leading a memory leak. Fix it by setting the ret -EINVAL and goto done. Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/all/202312040659.4pJpMafN-lkp@intel.com/ Fixes: 6b252cf ("drm/nouveau: nvkm/vmm: implement raw ops to manage uvmm") Signed-off-by: Fanhua Li <lifanhua5@huawei.com> Link: https://lore.kernel.org/r/20250728115027.50878-1-lifanhua5@huawei.com Signed-off-by: Danilo Krummrich <dakr@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent b4223df commit 7d9110e

File tree

1 file changed

+2
-1
lines changed
  • drivers/gpu/drm/nouveau/nvif

1 file changed

+2
-1
lines changed

drivers/gpu/drm/nouveau/nvif/vmm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,8 @@ nvif_vmm_ctor(struct nvif_mmu *mmu, const char *name, s32 oclass,
219219
case RAW: args->type = NVIF_VMM_V0_TYPE_RAW; break;
220220
default:
221221
WARN_ON(1);
222-
return -EINVAL;
222+
ret = -EINVAL;
223+
goto done;
223224
}
224225

225226
memcpy(args->data, argv, argc);

0 commit comments

Comments
 (0)