Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/xe/oa: Limit num_syncs to prevent oversized allocations

The OA open parameters did not validate num_syncs, allowing
userspace to pass arbitrarily large values, potentially
leading to excessive allocations.

Add check to ensure that num_syncs does not exceed DRM_XE_MAX_SYNCS,
returning -EINVAL when the limit is violated.

v2: use XE_IOCTL_DBG() and drop duplicated check. (Ashutosh)

Fixes: c8507a25cebd ("drm/xe/oa/uapi: Define and parse OA sync properties")
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patch.msgid.link/20251205234715.2476561-6-shuicheng.lin@intel.com

authored by

Shuicheng Lin and committed by
Matthew Brost
e057b2d2 b07bac9b

+3
+3
drivers/gpu/drm/xe/xe_oa.c
··· 1254 1254 static int xe_oa_set_prop_num_syncs(struct xe_oa *oa, u64 value, 1255 1255 struct xe_oa_open_param *param) 1256 1256 { 1257 + if (XE_IOCTL_DBG(oa->xe, value > DRM_XE_MAX_SYNCS)) 1258 + return -EINVAL; 1259 + 1257 1260 param->num_syncs = value; 1258 1261 return 0; 1259 1262 }