Skip to content

Commit 0cfe9c4

Browse files
guptavarrodrigovivi
authored andcommitted
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: 293032e ("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> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Link: https://patch.msgid.link/20260223175145.1532801-1-varun.gupta@intel.com Signed-off-by: Tejas Upadhyay <tejas.upadhyay@intel.com> (cherry picked from commit 29bd06f) Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
1 parent 3091723 commit 0cfe9c4

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/gpu/drm/xe/xe_vm_madvise.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ int xe_vm_madvise_ioctl(struct drm_device *dev, void *data, struct drm_file *fil
453453
madvise_range.num_vmas,
454454
args->atomic.val)) {
455455
err = -EINVAL;
456-
goto madv_fini;
456+
goto free_vmas;
457457
}
458458
}
459459

@@ -490,6 +490,7 @@ int xe_vm_madvise_ioctl(struct drm_device *dev, void *data, struct drm_file *fil
490490
err_fini:
491491
if (madvise_range.has_bo_vmas)
492492
drm_exec_fini(&exec);
493+
free_vmas:
493494
kfree(madvise_range.vmas);
494495
madvise_range.vmas = NULL;
495496
madv_fini:

0 commit comments

Comments
 (0)