Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe: Fix ref counting leak on page fault
@ 2024-03-01  4:10 Matthew Brost
  2024-03-01  4:48 ` ✓ CI.Patch_applied: success for " Patchwork
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Matthew Brost @ 2024-03-01  4:10 UTC (permalink / raw)
  To: intel-xe; +Cc: Matthew Brost

If a page fault occurs on VM not in fault a ref can be leaked. Fix this.

Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_gt_pagefault.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_gt_pagefault.c b/drivers/gpu/drm/xe/xe_gt_pagefault.c
index c26e4fcca01e..73c535193a98 100644
--- a/drivers/gpu/drm/xe/xe_gt_pagefault.c
+++ b/drivers/gpu/drm/xe/xe_gt_pagefault.c
@@ -146,10 +146,12 @@ static int handle_pagefault(struct xe_gt *gt, struct pagefault *pf)
 	/* ASID to VM */
 	mutex_lock(&xe->usm.lock);
 	vm = xa_load(&xe->usm.asid_to_vm, pf->asid);
-	if (vm)
+	if (vm && xe_vm_in_fault_mode(vm))
 		xe_vm_get(vm);
+	else
+		vm = NULL;
 	mutex_unlock(&xe->usm.lock);
-	if (!vm || !xe_vm_in_fault_mode(vm))
+	if (!vm)
 		return -EINVAL;
 
 retry_userptr:
-- 
2.34.1


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

end of thread, other threads:[~2024-03-01  8:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-01  4:10 [PATCH] drm/xe: Fix ref counting leak on page fault Matthew Brost
2024-03-01  4:48 ` ✓ CI.Patch_applied: success for " Patchwork
2024-03-01  4:48 ` ✓ CI.checkpatch: " Patchwork
2024-03-01  4:49 ` ✓ CI.KUnit: " Patchwork
2024-03-01  4:59 ` ✓ CI.Build: " Patchwork
2024-03-01  5:00 ` ✓ CI.Hooks: " Patchwork
2024-03-01  5:01 ` ✓ CI.checksparse: " Patchwork
2024-03-01  5:22 ` ✓ CI.BAT: " Patchwork
2024-03-01  8:07 ` [PATCH] " Mika Kuoppala

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