From: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
To: jani.nikula@linux.intel.com, rodrigo.vivi@intel.com,
joonas.lahtinen@linux.intel.com
Cc: intel-gfx@lists.freedesktop.org,
Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Subject: [PATCH] drm/i915: Prevent heap overflow in i915_l3_write()
Date: Wed, 28 Jan 2026 10:41:42 +0530 [thread overview]
Message-ID: <20260128051142.3006076-1-kaushlendra.kumar@intel.com> (raw)
The i915_l3_write() function failed to validate that the write
count did not exceed the remaining buffer size after the starting
offset. This allows userspace to trigger a heap buffer overflow.
Clamp the write count to the remaining size of the L3 log buffer
to ensure memory safety.
Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
---
drivers/gpu/drm/i915/i915_sysfs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
index 70e0d8615160..3c592111d0cc 100644
--- a/drivers/gpu/drm/i915/i915_sysfs.c
+++ b/drivers/gpu/drm/i915/i915_sysfs.c
@@ -121,6 +121,7 @@ i915_l3_write(struct file *filp, struct kobject *kobj,
}
count = round_down(count, sizeof(u32));
+ count = min_t(size_t, GEN7_L3LOG_SIZE - offset, count);
memcpy(remap_info + offset / sizeof(u32), buf, count);
/* NB: We defer the remapping until we switch to the context */
--
2.34.1
next reply other threads:[~2026-01-28 5:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-28 5:11 Kaushlendra Kumar [this message]
2026-01-28 7:06 ` ✓ i915.CI.BAT: success for drm/i915: Prevent heap overflow in i915_l3_write() Patchwork
2026-01-28 10:50 ` [PATCH] " Jani Nikula
2026-01-28 11:27 ` Kumar, Kaushlendra
2026-01-28 13:00 ` Jani Nikula
2026-03-23 15:00 ` Kumar, Kaushlendra
2026-01-28 14:16 ` ✗ i915.CI.Full: failure for " 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=20260128051142.3006076-1-kaushlendra.kumar@intel.com \
--to=kaushlendra.kumar@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=rodrigo.vivi@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