* [PATCH] drm/nouveau/nvif: Fix potential memory leak in nvif_vmm_ctor().
@ 2025-07-28 11:50 Fanhua Li
2025-08-09 12:38 ` Danilo Krummrich
0 siblings, 1 reply; 2+ messages in thread
From: Fanhua Li @ 2025-07-28 11:50 UTC (permalink / raw)
To: dri-devel, nouveau
Cc: liuyongqiang13, lyude, dakr, airlied, simona, airlied,
linux-kernel, suhui
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: 6b252cf42281 ("drm/nouveau: nvkm/vmm: implement raw ops to manage uvmm")
Signed-off-by: Fanhua Li <lifanhua5@huawei.com>
---
drivers/gpu/drm/nouveau/nvif/vmm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/nouveau/nvif/vmm.c b/drivers/gpu/drm/nouveau/nvif/vmm.c
index 99296f03371a..07c1ebc2a941 100644
--- a/drivers/gpu/drm/nouveau/nvif/vmm.c
+++ b/drivers/gpu/drm/nouveau/nvif/vmm.c
@@ -219,7 +219,8 @@ nvif_vmm_ctor(struct nvif_mmu *mmu, const char *name, s32 oclass,
case RAW: args->type = NVIF_VMM_V0_TYPE_RAW; break;
default:
WARN_ON(1);
- return -EINVAL;
+ ret = -EINVAL;
+ goto done;
}
memcpy(args->data, argv, argc);
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/nouveau/nvif: Fix potential memory leak in nvif_vmm_ctor().
2025-07-28 11:50 [PATCH] drm/nouveau/nvif: Fix potential memory leak in nvif_vmm_ctor() Fanhua Li
@ 2025-08-09 12:38 ` Danilo Krummrich
0 siblings, 0 replies; 2+ messages in thread
From: Danilo Krummrich @ 2025-08-09 12:38 UTC (permalink / raw)
To: Fanhua Li
Cc: dri-devel, nouveau, liuyongqiang13, lyude, airlied, simona,
airlied, linux-kernel, suhui
On 7/28/25 1:50 PM, Fanhua Li wrote:
> 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: 6b252cf42281 ("drm/nouveau: nvkm/vmm: implement raw ops to manage uvmm")
> Signed-off-by: Fanhua Li <lifanhua5@huawei.com>
Applied to drm-misc-fixes, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-09 12:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-28 11:50 [PATCH] drm/nouveau/nvif: Fix potential memory leak in nvif_vmm_ctor() Fanhua Li
2025-08-09 12:38 ` Danilo Krummrich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).