]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe/oa: Fix exec_queue leak on width check in stream open
authorShuicheng Lin <shuicheng.lin@intel.com>
Thu, 14 May 2026 20:32:10 +0000 (20:32 +0000)
committerShuicheng Lin <shuicheng.lin@intel.com>
Tue, 19 May 2026 15:48:46 +0000 (08:48 -0700)
In xe_oa_stream_open_ioctl(), when param.exec_q->width > 1 the
function returns -EOPNOTSUPP directly, skipping the existing
err_exec_q cleanup path. The exec_queue reference obtained by
xe_exec_queue_lookup() is leaked.

The exec queue holds a reference on the xe_file, which is only
dropped during queue teardown. The leaked lookup ref is not on
the file's exec_queue xarray, so file close cannot release it.
This keeps both the exec queue and the file private state pinned
indefinitely.

Jump to err_exec_q instead of returning directly so the reference
is released.

Fixes: f0ed39830e60 ("xe/oa: Fix query mode of operation for OAR/OAC")
Assisted-by: Claude:claude-opus-4.6
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Link: https://patch.msgid.link/20260514203210.593488-1-shuicheng.lin@intel.com
Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
drivers/gpu/drm/xe/xe_oa.c

index 7c9071abb44f129289357238278bfeb78d110cea..4bf4b1f65929f1f96c96ebfea6466b557a8f1f8a 100644 (file)
@@ -2051,8 +2051,10 @@ int xe_oa_stream_open_ioctl(struct drm_device *dev, u64 data, struct drm_file *f
                if (XE_IOCTL_DBG(oa->xe, !param.exec_q))
                        return -ENOENT;
 
-               if (XE_IOCTL_DBG(oa->xe, param.exec_q->width > 1))
-                       return -EOPNOTSUPP;
+               if (XE_IOCTL_DBG(oa->xe, param.exec_q->width > 1)) {
+                       ret = -EOPNOTSUPP;
+                       goto err_exec_q;
+               }
        }
 
        /*