Unverified Commit 0cfe9c48 authored by Varun Gupta's avatar Varun Gupta Committed by Rodrigo Vivi
Browse files

drm/xe: Fix memory leak in xe_vm_madvise_ioctl



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: 293032ee ("drm/xe/bo: Update atomic_access attribute on madvise")
Cc: stable@vger.kernel.org # v6.18+
Reviewed-by: default avatarShuicheng Lin <shuicheng.lin@intel.com>
Signed-off-by: default avatarVarun Gupta <varun.gupta@intel.com>
Reviewed-by: default avatarMatthew Brost <matthew.brost@intel.com>
Link: https://patch.msgid.link/20260223175145.1532801-1-varun.gupta@intel.com


Signed-off-by: default avatarTejas Upadhyay <tejas.upadhyay@intel.com>
(cherry picked from commit 29bd06fa)
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent 30917237
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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: