]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Oct 2025 05:55:10 +0000 (07:55 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Oct 2025 05:55:10 +0000 (07:55 +0200)
added patches:
hid-fix-i2c-read-buffer-overflow-in-raw_event-for-mcp2221.patch

queue-5.15/hid-fix-i2c-read-buffer-overflow-in-raw_event-for-mcp2221.patch [new file with mode: 0644]
queue-5.15/series

diff --git a/queue-5.15/hid-fix-i2c-read-buffer-overflow-in-raw_event-for-mcp2221.patch b/queue-5.15/hid-fix-i2c-read-buffer-overflow-in-raw_event-for-mcp2221.patch
new file mode 100644 (file)
index 0000000..8e5622b
--- /dev/null
@@ -0,0 +1,42 @@
+From b56cc41a3ae7323aa3c6165f93c32e020538b6d2 Mon Sep 17 00:00:00 2001
+From: Arnaud Lecomte <contact@arnaud-lcm.com>
+Date: Sat, 26 Jul 2025 23:09:31 +0100
+Subject: hid: fix I2C read buffer overflow in raw_event() for mcp2221
+
+From: Arnaud Lecomte <contact@arnaud-lcm.com>
+
+commit b56cc41a3ae7323aa3c6165f93c32e020538b6d2 upstream.
+
+As reported by syzbot, mcp2221_raw_event lacked
+validation of incoming I2C read data sizes, risking buffer
+overflows in mcp->rxbuf during multi-part transfers.
+As highlighted in the DS20005565B spec, p44, we have:
+"The number of read-back data bytes to follow in this packet:
+from 0 to a maximum of 60 bytes of read-back bytes."
+This patch enforces we don't exceed this limit.
+
+Reported-by: syzbot+52c1a7d3e5b361ccd346@syzkaller.appspotmail.com
+Closes: https://syzkaller.appspot.com/bug?extid=52c1a7d3e5b361ccd346
+Tested-by: syzbot+52c1a7d3e5b361ccd346@syzkaller.appspotmail.com
+Signed-off-by: Arnaud Lecomte <contact@arnaud-lcm.com>
+Link: https://patch.msgid.link/20250726220931.7126-1-contact@arnaud-lcm.com
+Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
+Signed-off-by: Romain Sioen <romain.sioen@microchip.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/hid/hid-mcp2221.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/hid/hid-mcp2221.c
++++ b/drivers/hid/hid-mcp2221.c
+@@ -791,6 +791,10 @@ static int mcp2221_raw_event(struct hid_
+                       }
+                       if (data[2] == MCP2221_I2C_READ_COMPL ||
+                           data[2] == MCP2221_I2C_READ_PARTIAL) {
++                              if (!mcp->rxbuf || mcp->rxbuf_idx < 0 || data[3] > 60) {
++                                      mcp->status = -EINVAL;
++                                      break;
++                              }
+                               buf = mcp->rxbuf;
+                               memcpy(&buf[mcp->rxbuf_idx], &data[4], data[3]);
+                               mcp->rxbuf_idx = mcp->rxbuf_idx + data[3];
index 91722803281d10fb3697a3cb04976a016f6b8ec3..3b192e6053b6d7ef0d456700ff229d993f059c09 100644 (file)
@@ -12,3 +12,4 @@ usb-serial-option-add-simcom-8230c-compositions.patch
 wifi-rtlwifi-rtl8192cu-don-t-claim-usb-id-07b8-8188.patch
 dm-integrity-limit-max_tag_size-to-255.patch
 perf-subcmd-avoid-crash-in-exclude_cmds-when-exclude.patch
+hid-fix-i2c-read-buffer-overflow-in-raw_event-for-mcp2221.patch