From: Lee Jones <lee@kernel.org>
To: lee@kernel.org, Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Elliot Tester <elliotctester@gmail.com>,
Marko Friedemann <mfr@bmx-chemnitz.de>,
Oliver Schwartz <Oliver.Schwartz@gmx.de>,
Steven Toth <steve@toth.demon.co.uk>,
Franz Lehner <franz@caos.at>,
Ivan Hawkes <blackhawk@ivanhawkes.com>,
Dominic Cerquetti <binary1230@yahoo.com>,
Adam Buchbinder <adam.buchbinder@gmail.com>,
Jan Kratochvil <honza@jikos.cz>,
Christoph Fritz <chf.fritz@googlemail.com>,
Pavel Rojtberg <rojtberg@gmail.com>,
"Pierre-Loup A. Griffais" <pgriffais@valvesoftware.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH 03/10] Input: xpad - cancel presence work on xpad360w_start_input() failure
Date: Fri, 27 Nov 2026 20:09:57 +0000 [thread overview]
Message-ID: <20261127201050.3532488-4-lee@kernel.org> (raw)
In-Reply-To: <20261127201050.3532488-1-lee@kernel.org>
xpad360w_start_input() submits xpad->irq_in before sending the presence
inquiry. If an incoming packet schedules xpad->work before
xpad_inquiry_pad_presence() fails, the error path kills the URB without
cancelling xpad->work, allowing xpad_presence_work() to run after
xpad_probe() frees xpad or leaving any input device registered by the
worker torn down improperly.
Cancel xpad->work synchronously after killing xpad->irq_in on error, and
run xpad_deinit_input() and xpad_stop_output() on probe failure in case
xpad_presence_work() already completed before cancellation.
Fixes: 09c8b00ae3e1 ("Input: xpad - handle "present" and "gone" correctly")
Closes: https://sashiko.dev/#/bug/linux-0c0def42-a340-45bb-860d-c99ba757f43b
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/input/joystick/xpad.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 86f4e756a7fc..ba0f5684f3d6 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -1880,6 +1880,7 @@ static int xpad360w_start_input(struct usb_xpad *xpad)
error = xpad_inquiry_pad_presence(xpad);
if (error) {
usb_kill_urb(xpad->irq_in);
+ cancel_work_sync(&xpad->work);
return error;
}
@@ -2210,8 +2211,11 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
* we're waiting for.
*/
error = xpad360w_start_input(xpad);
- if (error)
+ if (error) {
+ xpad_deinit_input(xpad);
+ xpad_stop_output(xpad);
goto err_deinit_output;
+ }
/*
* Wireless controllers require RESET_RESUME to work properly
* after suspend. Ideally this quirk should be in usb core
--
2.56.1.839.g22a8290db9-goog
next prev parent reply other threads:[~2026-11-27 20:11 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 20:09 [PATCH 00/10] Input: Fix OOB writes, UAFs, NULL derefs, and suspend work bugs (batch 2) Lee Jones
2026-11-27 20:09 ` [PATCH 01/10] Input: adi - prevent off-by-one write in adi_read_packet() Lee Jones
2026-11-30 5:42 ` Dmitry Torokhov
2026-11-27 20:09 ` [PATCH 02/10] Input: adi - validate axis and button counts in adi_id_decode() Lee Jones
2026-11-30 5:42 ` Dmitry Torokhov
2026-11-27 20:09 ` Lee Jones [this message]
2026-11-27 20:24 ` [PATCH 03/10] Input: xpad - cancel presence work on xpad360w_start_input() failure sashiko-bot
2026-11-27 20:09 ` [PATCH 04/10] Input: aw86927 - use devm_work_autocancel() for haptics play work Lee Jones
2026-11-27 20:09 ` [PATCH 05/10] Input: stmfts - fix i2c_smbus_read_i2c_block_data() check in status sysfs Lee Jones
2026-11-27 20:35 ` David Heidelberg
2026-11-28 6:09 ` Dmitry Torokhov
2026-11-27 20:10 ` [PATCH 06/10] Input: xen-kbdfront - check info->ptr and info->kbd before dereferencing Lee Jones
2026-11-30 6:04 ` Dmitry Torokhov
2026-11-27 20:10 ` [PATCH 07/10] Input: drv2665 - disable haptics work across suspend and resume Lee Jones
2026-11-27 20:10 ` [PATCH 08/10] Input: drv2667 " Lee Jones
2026-11-27 20:10 ` [PATCH 09/10] Input: goodix_berlin_i2c - check i2c_get_match_data() for NULL Lee Jones
2026-11-27 20:10 ` [PATCH 10/10] Input: goodix_berlin_spi - validate ic_data and SPI max transfer size Lee Jones
2026-11-29 6:27 ` Dmitry Torokhov
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=20261127201050.3532488-4-lee@kernel.org \
--to=lee@kernel.org \
--cc=Oliver.Schwartz@gmx.de \
--cc=adam.buchbinder@gmail.com \
--cc=binary1230@yahoo.com \
--cc=blackhawk@ivanhawkes.com \
--cc=chf.fritz@googlemail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=elliotctester@gmail.com \
--cc=franz@caos.at \
--cc=gregkh@linuxfoundation.org \
--cc=honza@jikos.cz \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mfr@bmx-chemnitz.de \
--cc=pgriffais@valvesoftware.com \
--cc=rojtberg@gmail.com \
--cc=stable@vger.kernel.org \
--cc=steve@toth.demon.co.uk \
/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.