From: sashiko-bot@kernel.org
To: "Griffin Kroah-Hartman" <griffin@kroah.com>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH] Input: xpad - add out-of-bounds checks for xpadone
Date: Mon, 27 Jul 2026 16:19:02 +0000 [thread overview]
Message-ID: <20260727161902.B4C6B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260727-xpadone_length_checks-v1-1-19aa9331e82d@kroah.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Early returns during packet processing bypass `input_sync()`, leaving previously reported events unsynchronized.
--
--- Patch [1]: [PATCH] Input: xpad - add out-of-bounds checks for xpadone ---
commit 8c34b8de402ad35f3c36f154396b4b591175f380
Author: Griffin Kroah-Hartman <griffin@kroah.com>
Input: xpad - add out-of-bounds checks for xpadone
Add size checks for the len variable in xpadone_process_packet() to
prevent out-of-bounds accesses to the data buffer.
> diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
> --- a/drivers/input/joystick/xpad.c
> +++ b/drivers/input/joystick/xpad.c
> @@ -1079,6 +1087,8 @@ static void xpadone_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char
> error);
> }
> } else if (data[0] == GIP_CMD_INPUT) { /* The main valid packet type for inputs */
> + if (len < 18)
> + return;
> /* menu/view buttons */
> input_report_key(dev, BTN_START, data[4] & BIT(2));
> input_report_key(dev, BTN_SELECT, data[4] & BIT(3));
[ ... ]
> @@ -1145,13 +1155,18 @@ static void xpadone_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char
> }
>
> /* Profile button has a value of 0-3, so it is reported as an axis */
> - if (xpad->mapping & MAP_PROFILE_BUTTON)
> + if (xpad->mapping & MAP_PROFILE_BUTTON) {
> + if (len < 35)
> + return;
[Severity: High]
By returning early here, do we bypass the synchronization of the standard
buttons and axes that were already reported earlier in this function?
If the controller sends a valid base GIP_CMD_INPUT packet (>= 18 bytes) but
shorter than 35 bytes, this early return skips the do_sync = true assignment
and the final input_sync() call at the end of xpadone_process_packet().
Would this result in standard inputs becoming unresponsive since the events are
buffered by the input core but never delivered to userspace?
> input_report_abs(dev, ABS_PROFILE, data[34]);
> + }
>
> /* paddle handling */
> /* based on SDL's SDL_hidapi_xboxone.c */
> if (xpad->mapping & MAP_PADDLES) {
> if (xpad->packet_type == PKT_XBE1) {
> + if (len < 33)
> + return;
[Severity: High]
This early return, as well as the ones below for PKT_XBE2_FW_OLD and
PKT_XBE2_FW_5_EARLY, appear to have the same issue. Do they also skip
input_sync() for the standard inputs?
> /* Mute paddles if controller has a custom mapping applied.
> * Checked by comparing the current mapping
> * config against the factory mapping config
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260727-xpadone_length_checks-v1-1-19aa9331e82d@kroah.com?part=1
prev parent reply other threads:[~2026-07-27 16:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-27 16:11 [PATCH] Input: xpad - add out-of-bounds checks for xpadone Griffin Kroah-Hartman
2026-07-27 16:19 ` sashiko-bot [this message]
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=20260727161902.B4C6B1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=griffin@kroah.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox