Skip to contentSkip to conversation

HID: mcp2221: fix slab out-of-bounds in mcp2221_raw_event

PATCH In review Atharv Dubey 2 participants 2 messages Nov 3, 2025 – Nov 18, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: mcp2221: fix slab out-of-bounds in mcp2221_raw_event

Fixes an out-of-bounds read triggered by malformed HID input reports.

Fixes 3a8660878839 ("HID: mcp2221: add support for MCP2221 HID adapter")
Reported-by [email protected]
---
 drivers/hid/hid-mcp2221.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-mcp2221.c +1 -1
index a9fd7648515d..c97f0acbac8b 100644
@@ -945,7 +945,7 @@ static int mcp2221_raw_event(struct hid_device *hdev,
 		switch (data[1]) {
 		case MCP2221_SUCCESS:
 			if ((data[mcp->gp_idx] == MCP2221_ALT_F_NOT_GPIOV) ||
-				(mcp->gp_idx > 0 &&data[mcp->gp_idx - 1] == MCP2221_ALT_F_NOT_GPIOV)) {
+				(mcp->gp_idx > 0 && data[mcp->gp_idx - 1] == MCP2221_ALT_F_NOT_GPIOV)) {
 				mcp->status = -ENOENT;
 			} else {
 				mcp->status = 0;
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 3 lines · Atharv Dubey

Fixes an out-of-bounds read triggered by malformed HID input reports.

Fixes 3a8660878839 ("HID: mcp2221: add support for MCP2221 HID adapter")

The commit hash and the commit name don't match.

3a8660878839 is a Makefile update to reflect new kernel version, and commit with shortlog "HID: mcp2221: add support for MCP2221 HID adapter" doesn't seem to exist ...

Quoted 12 lines
---
 drivers/hid/hid-mcp2221.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-mcp2221.c +0 -0
index a9fd7648515d..c97f0acbac8b 100644

drivers/hid/hid-mcp2221.c static int mcp2221_raw_event(struct hid_device *hdev, · line 948

Quoted 4 lines
drivers/hid/hid-mcp2221.c +0 -1
@@ -945,7 +945,7 @@ static int mcp2221_raw_event(struct hid_device *hdev,
 		switch (data[1]) {
 		case MCP2221_SUCCESS:
 			if ((data[mcp->gp_idx] == MCP2221_ALT_F_NOT_GPIOV) ||
-				(mcp->gp_idx > 0 &&data[mcp->gp_idx - 1] == MCP2221_ALT_F_NOT_GPIOV)) {

... nor does this code.

What tree is this patch against?

Signature · 2 lines
Jiri Kosina
SUSE Labs