[Intel-xe] [PATCH] drm/xe: Fix engine lookup refcount race
Thomas Hellström
thomas.hellstrom at linux.intel.com
Thu May 25 08:16:15 UTC 2023
Fix a race where the engine could disappear between lookup unlock and
xe_engine_get().
Signed-off-by: Thomas Hellström <thomas.hellstrom at 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
More information about the Intel-xe
mailing list