From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Shuicheng Lin <shuicheng.lin@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
Matthew Brost <matthew.brost@intel.com>
Subject: Re: [PATCH v3 2/2] drm/xe/oa: Limit num_syncs to prevent oversized allocations
Date: Fri, 05 Dec 2025 16:05:09 -0800 [thread overview]
Message-ID: <87jyz0pj9m.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20251205234715.2476561-6-shuicheng.lin@intel.com>
On Fri, 05 Dec 2025 15:47:18 -0800, Shuicheng Lin wrote:
>
> 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)
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
>
> 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>
> ---
> drivers/gpu/drm/xe/xe_oa.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
> index cc48663c2b48..92aa25fc0422 100644
> --- a/drivers/gpu/drm/xe/xe_oa.c
> +++ b/drivers/gpu/drm/xe/xe_oa.c
> @@ -1254,6 +1254,9 @@ static int xe_oa_set_no_preempt(struct xe_oa *oa, u64 value,
> static int xe_oa_set_prop_num_syncs(struct xe_oa *oa, u64 value,
> struct xe_oa_open_param *param)
> {
> + if (XE_IOCTL_DBG(oa->xe, value > DRM_XE_MAX_SYNCS))
> + return -EINVAL;
> +
> param->num_syncs = value;
> return 0;
> }
> --
> 2.50.1
>
next prev parent reply other threads:[~2025-12-06 0:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-05 23:47 [PATCH v3 0/2] Limit num_syncs to prevent oversized allocations Shuicheng Lin
2025-12-05 23:47 ` [PATCH v3 1/2] drm/xe: " Shuicheng Lin
2025-12-05 23:57 ` Matthew Brost
2025-12-05 23:47 ` [PATCH v3 2/2] drm/xe/oa: " Shuicheng Lin
2025-12-06 0:05 ` Dixit, Ashutosh [this message]
2025-12-06 0:33 ` ✗ CI.checkpatch: warning for Limit num_syncs to prevent oversized allocations (rev3) Patchwork
2025-12-06 0:34 ` ✓ CI.KUnit: success " Patchwork
2025-12-06 1:52 ` ✓ Xe.CI.BAT: " Patchwork
2025-12-06 12:51 ` ✗ Xe.CI.Full: failure " Patchwork
2025-12-06 18:59 ` Lin, Shuicheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87jyz0pj9m.wl-ashutosh.dixit@intel.com \
--to=ashutosh.dixit@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@intel.com \
--cc=shuicheng.lin@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox