public inbox for intel-xe@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH v3] drm/xe: Fix memory leak in xe_vm_madvise_ioctl
@ 2026-02-23 17:51 Varun Gupta
  2026-02-23 18:22 ` Matthew Brost
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Varun Gupta @ 2026-02-23 17:51 UTC (permalink / raw)
  To: intel-xe
  Cc: himal.prasad.ghimiray, matthew.brost, thomas.hellstrom,
	shuicheng.lin

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: 293032eec4ba ("drm/xe/bo: Update atomic_access attribute on madvise")
Cc: stable@vger.kernel.org # v6.18+
Reviewed-by: Shuicheng Lin <shuicheng.lin@intel.com>
Signed-off-by: Varun Gupta <varun.gupta@intel.com>
---
v3:
 - Corrected Fixes tag to 293032eec4ba (Shuicheng Lin)
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-03-02 15:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-23 17:51 [PATCH v3] drm/xe: Fix memory leak in xe_vm_madvise_ioctl Varun Gupta
2026-02-23 18:22 ` Matthew Brost
2026-02-23 18:34 ` ✓ CI.KUnit: success for drm/xe: Fix memory leak in xe_vm_madvise_ioctl (rev3) Patchwork
2026-03-02 13:46 ` ✓ CI.KUnit: success for drm/xe: Fix memory leak in xe_vm_madvise_ioctl (rev4) Patchwork
2026-03-02 14:28 ` ✓ Xe.CI.BAT: " Patchwork
2026-03-02 15:32 ` ✗ Xe.CI.FULL: failure " Patchwork

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