From: Shuicheng Lin <shuicheng.lin@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: "Shuicheng Lin" <shuicheng.lin@intel.com>,
stable@vger.kernel.org, "Matthew Brost" <matthew.brost@intel.com>,
"Michal Mrozek" <michal.mrozek@intel.com>,
"Carl Zhang" <carl.zhang@intel.com>,
"José Roberto de Souza" <jose.souza@intel.com>,
"Lionel Landwerlin" <lionel.g.landwerlin@intel.com>,
"Ivan Briano" <ivan.briano@intel.com>,
"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Ashutosh Dixit" <ashutosh.dixit@intel.com>
Subject: [PATCH 2/3] drm/xe/vm: Limit num_syncs to prevent oversized allocations
Date: Fri, 5 Dec 2025 19:05:09 +0000 [thread overview]
Message-ID: <20251205190506.2426471-7-shuicheng.lin@intel.com> (raw)
In-Reply-To: <20251205190506.2426471-5-shuicheng.lin@intel.com>
The VM_BIND ioctl did not validate args->num_syncs, allowing userspace
to pass excessively large values that could lead to oversized allocations
or other unexpected behavior.
Add a check to ensure num_syncs does not exceed XE_MAX_SYNCS,
returning -EINVAL when the limit is violated.
Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Cc: <stable@vger.kernel.org> # v6.12+
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Michal Mrozek <michal.mrozek@intel.com>
Cc: Carl Zhang <carl.zhang@intel.com>
Cc: José Roberto de Souza <jose.souza@intel.com>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: Ivan Briano <ivan.briano@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
---
drivers/gpu/drm/xe/xe_vm.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index c2012d20faa6..2ada14ed1f3c 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -3341,6 +3341,9 @@ static int vm_bind_ioctl_check_args(struct xe_device *xe, struct xe_vm *vm,
if (XE_IOCTL_DBG(xe, args->extensions))
return -EINVAL;
+ if (XE_IOCTL_DBG(xe, args->num_syncs > XE_MAX_SYNCS))
+ return -EINVAL;
+
if (args->num_binds > 1) {
u64 __user *bind_user =
u64_to_user_ptr(args->vector_of_binds);
--
2.50.1
next prev parent reply other threads:[~2025-12-05 19:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-05 19:05 [PATCH 0/3] Limit num_syncs to prevent oversized allocations Shuicheng Lin
2025-12-05 19:05 ` [PATCH 1/3] drm/xe/exec: " Shuicheng Lin
2025-12-05 21:23 ` Matthew Brost
2025-12-05 19:05 ` Shuicheng Lin [this message]
2025-12-05 19:05 ` [PATCH 3/3] drm/xe/oa: " Shuicheng Lin
2025-12-05 20:36 ` Dixit, Ashutosh
2025-12-05 20:55 ` Matthew Brost
2025-12-05 21:06 ` Dixit, Ashutosh
2025-12-05 22:03 ` ✗ CI.checkpatch: warning for " Patchwork
2025-12-05 22:05 ` ✓ CI.KUnit: success " Patchwork
2025-12-05 23:08 ` ✓ Xe.CI.BAT: " Patchwork
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=20251205190506.2426471-7-shuicheng.lin@intel.com \
--to=shuicheng.lin@intel.com \
--cc=ashutosh.dixit@intel.com \
--cc=carl.zhang@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=ivan.briano@intel.com \
--cc=jose.souza@intel.com \
--cc=lionel.g.landwerlin@intel.com \
--cc=matthew.brost@intel.com \
--cc=michal.mrozek@intel.com \
--cc=stable@vger.kernel.org \
--cc=thomas.hellstrom@linux.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