Skip to content

Commit f7da398

Browse files
mbrost05lucasdemarchi
authored andcommitted
drm/xe: Fix ref counting leak on page fault
If a page fault occurs on VM not in fault a ref can be leaked. Fix this. Fixes: dd08ebf ("drm/xe: Introduce a new DRM driver for Intel GPUs") Signed-off-by: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240301041036.238471-1-matthew.brost@intel.com (cherry picked from commit 27b5a3f) Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
1 parent c6f6750 commit f7da398

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/gpu/drm/xe/xe_gt_pagefault.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,12 @@ static int handle_pagefault(struct xe_gt *gt, struct pagefault *pf)
146146
/* ASID to VM */
147147
mutex_lock(&xe->usm.lock);
148148
vm = xa_load(&xe->usm.asid_to_vm, pf->asid);
149-
if (vm)
149+
if (vm && xe_vm_in_fault_mode(vm))
150150
xe_vm_get(vm);
151+
else
152+
vm = NULL;
151153
mutex_unlock(&xe->usm.lock);
152-
if (!vm || !xe_vm_in_fault_mode(vm))
154+
if (!vm)
153155
return -EINVAL;
154156

155157
retry_userptr:

0 commit comments

Comments
 (0)