From: Matthew Brost <matthew.brost@intel.com>
To: <intel-xe@lists.freedesktop.org>
Cc: Matthew Brost <matthew.brost@intel.com>
Subject: [PATCH] drm/xe: Fix ref counting leak on page fault
Date: Thu, 29 Feb 2024 20:10:36 -0800 [thread overview]
Message-ID: <20240301041036.238471-1-matthew.brost@intel.com> (raw)
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
next reply other threads:[~2024-03-01 4:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-01 4:10 Matthew Brost [this message]
2024-03-01 4:48 ` ✓ CI.Patch_applied: success for drm/xe: Fix ref counting leak on page fault 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240301041036.238471-1-matthew.brost@intel.com \
--to=matthew.brost@intel.com \
--cc=intel-xe@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox