[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240324223455.1342824-511-sashal@kernel.org>
Date: Sun, 24 Mar 2024 18:31:29 -0400
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Cc: Matthew Brost <matthew.brost@...el.com>,
Mika Kuoppala <mika.kuoppala@...ux.intel.com>,
Lucas De Marchi <lucas.demarchi@...el.com>,
Sasha Levin <sashal@...nel.org>
Subject: [PATCH 6.8 510/715] drm/xe: Fix ref counting leak on page fault
From: Matthew Brost <matthew.brost@...el.com>
[ Upstream commit f7da398935f7ddabf1a098714593e032c875cd74 ]
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@...el.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@...ux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240301041036.238471-1-matthew.brost@intel.com
(cherry picked from commit 27b5a3f237fe66dbf2288c2b50973aee8a427e41)
Signed-off-by: Lucas De Marchi <lucas.demarchi@...el.com>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
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 73f08f1924df2..e2cf1759527c6 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.43.0
Powered by blists - more mailing lists