]> git.ipfire.org Git - thirdparty/linux.git/commit
drm/xe/guc: Fix resource leak in xe_guc_ct_init_noalloc()
authorShuicheng Lin <shuicheng.lin@intel.com>
Mon, 10 Nov 2025 18:45:23 +0000 (18:45 +0000)
committerLucas De Marchi <lucas.demarchi@intel.com>
Fri, 21 Nov 2025 16:08:24 +0000 (08:08 -0800)
commit2e4ad5b0667244f496783c58de0995b9562d3344
treeac6df9f1a76e09d52bbaa5834c987221a41487a3
parent62519b77aecad22b525eda482660ffa127e7ad80
drm/xe/guc: Fix resource leak in xe_guc_ct_init_noalloc()

xe_guc_ct_init_noalloc() allocates the CT workqueue and other helpers
before it tries to initialize ct->lock. If drmm_mutex_init() fails
we currently bail out without releasing those resources because the
guc_ct_fini() hasn’t been registered yet.

Since destroy_workqueue() in guc_ct_fini() may flush the workqueue, which
in turn can take the ct lock, the initialization sequence is restructured
to first initialize the ct->lock, then set up all CT state, and finally
register guc_ct_fini().

v2: guc_ct_fini() does take ct lock. (Matt)
v3: move primelockdep() together with drmm_mutex_init(). (Lucas)

Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patch.msgid.link/20251110184522.1581001-2-shuicheng.lin@intel.com
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
drivers/gpu/drm/xe/xe_guc_ct.c