All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-xe] [PATCH] drm/xe: Fix engine lookup refcount race
@ 2023-05-25  8:16 Thomas Hellström
  2023-05-25  8:20 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Thomas Hellström @ 2023-05-25  8:16 UTC (permalink / raw)
  To: intel-xe

Fix a race where the engine could disappear between lookup unlock and
xe_engine_get().

Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
---
 drivers/gpu/drm/xe/xe_engine.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_engine.c b/drivers/gpu/drm/xe/xe_engine.c
index 094ec17d3004..3a400a546dfe 100644
--- a/drivers/gpu/drm/xe/xe_engine.c
+++ b/drivers/gpu/drm/xe/xe_engine.c
@@ -161,10 +161,9 @@ struct xe_engine *xe_engine_lookup(struct xe_file *xef, u32 id)
 
 	mutex_lock(&xef->engine.lock);
 	e = xa_load(&xef->engine.xa, id);
-	mutex_unlock(&xef->engine.lock);
-
 	if (e)
 		xe_engine_get(e);
+	mutex_unlock(&xef->engine.lock);
 
 	return e;
 }
-- 
2.39.2


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

end of thread, other threads:[~2023-05-25 11:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-25  8:16 [Intel-xe] [PATCH] drm/xe: Fix engine lookup refcount race Thomas Hellström
2023-05-25  8:20 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
2023-05-25  8:22 ` [Intel-xe] ✓ CI.KUnit: " Patchwork
2023-05-25  8:25 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-05-25  8:54 ` [Intel-xe] ○ CI.BAT: info " Patchwork
2023-05-25 10:52 ` [Intel-xe] [PATCH] " Matthew Auld
2023-05-25 11:29   ` Thomas Hellström

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.