Thread (3 messages) 3 messages, 3 authors, 1d ago

Re: [PATCH v2] Input: xpad - add support for generic clone X-Input gamepads

From: sashiko-bot@kernel.org
Date: 2026-07-26 17:27:11

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Using `USB_DEVICE()` matches all interfaces on the composite device, causing `xpad` to improperly bind to the generic HID interface alongside the vendor-specific interface.
--
--- Patch [1]: [PATCH v2] Input: xpad - add support for generic clone X-Input gamepads ---
commit 00ab3ea53016b88e3489cabeb13695b6e3ca4191
Author: Ishaan Dandekar [off-list ref]

Input: xpad - add support for generic clone X-Input gamepads

This patch adds the vendor and product ID (0283:0001) for a generic clone
X-Input gamepad to xpad_device and xpad_table. This allows the device to
be recognized and initialized as an X-Input gamepad instead of falling back
to a generic HID interface.
quoted hunk ↗ jump to hunk
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index feb8f368f834e..c0a15db032963 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
[ ... ]
quoted hunk ↗ jump to hunk
@@ -496,6 +497,7 @@ static const struct usb_device_id xpad_table[] = {
 	 */
 	{ USB_INTERFACE_INFO('X', 'B', 0) },	/* Xbox USB-IF not-approved class */
 	XPAD_XBOX360_VENDOR(0x0079),		/* GPD Win 2 controller */
+	{ USB_DEVICE(0x0283, 0x0001) }, /* Generic X-Input Gamepad */
[Severity: High]
Will using USB_DEVICE() here cause the driver to incorrectly bind to the
device's generic HID interface as well?

Since USB_DEVICE() only matches by Vendor and Product ID without checking
the interface class, this appears to match all interfaces on the composite
device.

Because the device is found in the xpad_device table, xpad_probe() will set
the xtype to XTYPE_XBOX360. This bypasses the XTYPE_UNKNOWN check later in
xpad_probe() that normally verifies if the interface class is
USB_CLASS_VENDOR_SPEC.

If xpad binds to the standard HID interface, it could steal it from usbhid,
create a ghost input device, and send invalid X-Input packets to the generic
HID OUT endpoint. Could this be avoided by using the XPAD_XBOX360_VENDOR()
macro or specifying the interface match flags directly?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260726171526.43071-1-ishaan.dandekar@gmail.com?part=1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help