From: sashiko-bot@kernel.org
To: "Griffin Kroah-Hartman" <griffin@kroah.com>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH 1/3] Input: xpad - add safer data access framework
Date: Mon, 03 Aug 2026 15:27:04 +0000 [thread overview]
Message-ID: <20260803152705.63B0C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260803-xpadone_packet_fix-v1-1-280da203f15c@kroah.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Processing GIP_CMD_ANNOUNCE can trigger sleeping functions from an URB completion handler.
--
--- Patch [1]: [PATCH 1/3] Input: xpad - add safer data access framework ---
commit 852b38f29eb8d0217357629e77fd629842b2aed4
Author: Griffin Kroah-Hartman <griffin@kroah.com>
Input: xpad - add safer data access framework
This commit introduces a safe_data struct and a safe data check function to
prevent reads and writes outside of the data buffer bounds.
> diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
> index feb8f368f834e..c516860711a82 100644
> --- a/drivers/input/joystick/xpad.c
> +++ b/drivers/input/joystick/xpad.c
[ ... ]
> @@ -1078,44 +1100,49 @@ static void xpadone_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char
[ ... ]
> - } else if (data[0] == GIP_CMD_ANNOUNCE) {
> + } else if (sdata_check(&sdata, 0) == GIP_CMD_ANNOUNCE) {
> int error;
>
> if (xpad->delay_init && !xpad->delayed_init_done) {
> xpad->delayed_init_done = true;
> error = xpad_start_input(xpad);
[Severity: High]
This is a pre-existing issue, but does this code path trigger sleeping
functions from an atomic context?
When an Xbox One controller sends a GIP_CMD_ANNOUNCE packet on the irq_in
endpoint, the URB completion handler (which runs in atomic softirq context)
processes it via xpadone_process_packet().
If xpad->delay_init is true and initialization hasn't completed, it calls
xpad_start_input(), which subsequently uses GFP_KERNEL:
xpad_start_input() {
...
if (usb_submit_urb(xpad->irq_in, GFP_KERNEL))
return -EIO;
...
}
Additionally, xpad_start_input() calls xpad_start_xbox_one(), which makes a
synchronous blocking call that sleeps:
xpad_start_xbox_one() {
...
error = usb_set_interface(xpad->udev, GIP_WIRED_INTF_AUDIO, 0);
...
}
Could this lead to a scheduling while atomic kernel panic when a device sends
this command during URB completion?
> if (error)
> dev_warn(&xpad->dev->dev,
> "unable to start delayed input: %d\n",
> error);
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260803-xpadone_packet_fix-v1-0-280da203f15c@kroah.com?part=1
next prev parent reply other threads:[~2026-08-03 15:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 15:07 [PATCH 0/3] XPAD safety strengthening Griffin Kroah-Hartman
2026-08-03 15:07 ` [PATCH 1/3] Input: xpad - add safer data access framework Griffin Kroah-Hartman
2026-08-03 15:27 ` sashiko-bot [this message]
2026-08-03 16:23 ` Dmitry Torokhov
2026-08-04 8:02 ` Griffin Kroah-Hartman
2026-08-03 15:07 ` [PATCH 2/3] Input: xpad - add sdata_check() to xpad controllers Griffin Kroah-Hartman
2026-08-03 15:46 ` sashiko-bot
2026-08-03 15:07 ` [PATCH 3/3] Input: xpad - add sdata_check() to xpad360 branches Griffin Kroah-Hartman
2026-08-03 16:05 ` sashiko-bot
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=20260803152705.63B0C1F000E9@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