diff options
| author | Tomasz Lis <tomasz.lis@intel.com> | 2026-02-26 22:26:58 +0100 |
|---|---|---|
| committer | Michal Wajdeczko <michal.wajdeczko@intel.com> | 2026-02-27 18:02:03 +0100 |
| commit | 393e5fea6f7d7054abc2c3d97a4cfe8306cd6079 (patch) | |
| tree | 655cc8cdc4f1ae7ca43dbe47a6ce922cfcafa49b /drivers/gpu/drm/xe/xe_lrc.h | |
| parent | 223b2f51ba6bbf70dbebdb69b93b66b074289e04 (diff) | |
| download | linux-next-393e5fea6f7d7054abc2c3d97a4cfe8306cd6079.tar.gz linux-next-393e5fea6f7d7054abc2c3d97a4cfe8306cd6079.zip | |
drm/xe/queue: Call fini on exec queue creation fail
Every call to queue init should have a corresponding fini call.
Skipping this would mean skipping removal of the queue from GuC list
(which is part of guc_id allocation). A damaged queue stored in
exec_queue_lookup list would lead to invalid memory reference,
sooner or later.
Call fini to free guc_id. This must be done before any internal
LRCs are freed.
Since the finalization with this extra call became very similar to
__xe_exec_queue_fini(), reuse that. To make this reuse possible,
alter xe_lrc_put() so it can survive NULL parameters, like other
similar functions.
v2: Reuse _xe_exec_queue_fini(). Make xe_lrc_put() aware of NULLs.
Fixes: 3c1fa4aa60b1 ("drm/xe: Move queue init before LRC creation")
Signed-off-by: Tomasz Lis <tomasz.lis@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com> (v1)
Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Link: https://patch.msgid.link/20260226212701.2937065-2-tomasz.lis@intel.com
Diffstat (limited to 'drivers/gpu/drm/xe/xe_lrc.h')
| -rw-r--r-- | drivers/gpu/drm/xe/xe_lrc.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/xe/xe_lrc.h b/drivers/gpu/drm/xe/xe_lrc.h index 3e500004f1ae..48f7c26cf129 100644 --- a/drivers/gpu/drm/xe/xe_lrc.h +++ b/drivers/gpu/drm/xe/xe_lrc.h @@ -75,7 +75,8 @@ static inline struct xe_lrc *xe_lrc_get(struct xe_lrc *lrc) */ static inline void xe_lrc_put(struct xe_lrc *lrc) { - kref_put(&lrc->refcount, xe_lrc_destroy); + if (lrc) + kref_put(&lrc->refcount, xe_lrc_destroy); } /** |
