Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/xe: Fix memory leak in xe_vm_madvise_ioctl
@ 2026-02-23  9:28 Varun Gupta
  2026-02-23 10:09 ` ✓ CI.KUnit: success for drm/xe: Fix memory leak in xe_vm_madvise_ioctl (rev2) Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Varun Gupta @ 2026-02-23  9:28 UTC (permalink / raw)
  To: intel-xe; +Cc: himal.prasad.ghimiray, matthew.brost, thomas.hellstrom

When check_bo_args_are_sane() validation fails, jump to the new
free_vmas cleanup label to properly free the allocated resources.
This ensures proper cleanup in this error path.

Fixes: dff547e137be ("drm/xe/uapi: Extend the madvise functionality to support foreign pagemap placement for svm")
Cc: stable@vger.kernel.org
Signed-off-by: Varun Gupta <varun.gupta@intel.com>
---
v2:
 - Added Fixes tag and CC stable (Matt Brost)
---
 drivers/gpu/drm/xe/xe_vm_madvise.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_vm_madvise.c b/drivers/gpu/drm/xe/xe_vm_madvise.c
index 52147f5eaaa0..0c92fed6c6a6 100644
--- a/drivers/gpu/drm/xe/xe_vm_madvise.c
+++ b/drivers/gpu/drm/xe/xe_vm_madvise.c
@@ -453,7 +453,7 @@ int xe_vm_madvise_ioctl(struct drm_device *dev, void *data, struct drm_file *fil
 						    madvise_range.num_vmas,
 						    args->atomic.val)) {
 				err = -EINVAL;
-				goto madv_fini;
+				goto free_vmas;
 			}
 		}
 
@@ -490,6 +490,7 @@ int xe_vm_madvise_ioctl(struct drm_device *dev, void *data, struct drm_file *fil
 err_fini:
 	if (madvise_range.has_bo_vmas)
 		drm_exec_fini(&exec);
+free_vmas:
 	kfree(madvise_range.vmas);
 	madvise_range.vmas = NULL;
 madv_fini:
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-02-24  1:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-23  9:28 [PATCH v2] drm/xe: Fix memory leak in xe_vm_madvise_ioctl Varun Gupta
2026-02-23 10:09 ` ✓ CI.KUnit: success for drm/xe: Fix memory leak in xe_vm_madvise_ioctl (rev2) Patchwork
2026-02-23 11:23 ` ✓ Xe.CI.BAT: " Patchwork
2026-02-23 17:29 ` [PATCH v2] drm/xe: Fix memory leak in xe_vm_madvise_ioctl Lin, Shuicheng
2026-02-23 17:43   ` Gupta, Varun
2026-02-24  1:50 ` ✓ Xe.CI.FULL: success for drm/xe: Fix memory leak in xe_vm_madvise_ioctl (rev2) Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox