From: sashiko-bot@kernel.org
To: "Ishaan Dandekar" <ishaan.dandekar@gmail.com>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH v2] Input: xpad - add support for generic clone X-Input gamepads
Date: Sun, 26 Jul 2026 17:27:10 +0000 [thread overview]
Message-ID: <20260726172711.0602B1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260726171526.43071-1-ishaan.dandekar@gmail.com>
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 <ishaan.dandekar@gmail.com>
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.
> 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
[ ... ]
> @@ -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
next prev parent reply other threads:[~2026-07-26 17:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-26 17:15 [PATCH v2] Input: xpad - add support for generic clone X-Input gamepads Ishaan Dandekar
2026-07-26 17:27 ` sashiko-bot [this message]
2026-07-27 4:38 ` Greg KH
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=20260726172711.0602B1F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=ishaan.dandekar@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.