FAILED: patch "[PATCH] HID: nintendo: stop device IO before hid_hw_stop on probe" failed to apply to 6.6-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x 1f74d3bff6fe04a64e02ab3661d2e0d554565aa6
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026082537-drown-acquaint-6edf@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 1f74d3bff6fe04a64e02ab3661d2e0d554565aa6 Mon Sep 17 00:00:00 2001
From: Jiangshan Yi <[email protected]>
Date: Thu, 30 Jul 2026 11:19:27 +0800
Subject: [PATCH] HID: nintendo: stop device IO before hid_hw_stop on probe
failure
nintendo_hid_probe() calls hid_device_io_start() before joycon_init() and joycon_leds_create(). If either fails, the error path jumps to err_close which calls hid_hw_close()/hid_hw_stop() without first calling hid_device_io_stop().
hid_hw_stop() does not stop device IO, so hid_input_report() may still run and access driver data that is being torn down, resulting in a use-after-free.
Add an err_io_stop label that calls hid_device_io_stop() before hid_hw_close(), and point the two post-io_start error paths at it.
drivers/hid/hid-nintendo.c +4 -3
@@ -2736,14 +2736,14 @@ static int nintendo_hid_probe(struct hid_device *hdev, ret =joycon_init (hdev);if (ret) {hid_err (hdev,"Failed to initialize controller; ret=%d\n" , ret); - goto err_close; + goto err_io_stop; }/* Initialize the leds */ ret =joycon_leds_create (ctlr);if (ret) {hid_err (hdev,"Failed to create leds; ret=%d\n" , ret); - goto err_close; + goto err_io_stop; }/* Initialize the battery power supply */
@@ -2766,7 +2766,8 @@ static int nintendo_hid_probe(struct hid_device *hdev, err_ida:ida_free (&nintendo_player_id_allocator, ctlr->player_id); -err_close: +err_io_stop: +hid_device_io_stop (hdev);hid_hw_close (hdev); err_stop:hid_hw_stop (hdev);
Sasha Levin
maintainerPATCH 1/1 HID: nintendo: stop device IO before hid_hw_stop on probe failure
From: Jiangshan Yi <[email protected]>
[ Upstream commit 1f74d3bff6fe04a64e02ab3661d2e0d554565aa6 ]
nintendo_hid_probe() calls hid_device_io_start() before joycon_init() and joycon_leds_create(). If either fails, the error path jumps to err_close which calls hid_hw_close()/hid_hw_stop() without first calling hid_device_io_stop().
hid_hw_stop() does not stop device IO, so hid_input_report() may still run and access driver data that is being torn down, resulting in a use-after-free.
Add an err_io_stop label that calls hid_device_io_stop() before hid_hw_close(), and point the two post-io_start error paths at it.
--- drivers/hid/hid-nintendo.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/hid/hid-nintendo.c +7 -6
@@ -2345,34 +2345,34 @@ static int nintendo_hid_probe(struct hid_device *hdev, ret =joycon_init (hdev);if (ret) {hid_err (hdev,"Failed to initialize controller; ret=%d\n" , ret); - goto err_close; + goto err_io_stop; } ret =joycon_read_info (ctlr);if (ret) {hid_err (hdev,"Failed to retrieve controller info; ret=%d\n" , ret); - goto err_close; + goto err_io_stop; }/* Initialize the leds */ ret =joycon_leds_create (ctlr);if (ret) {hid_err (hdev,"Failed to create leds; ret=%d\n" , ret); - goto err_close; + goto err_io_stop; }/* Initialize the battery power supply */ ret =joycon_power_supply_create (ctlr);if (ret) {hid_err (hdev,"Failed to create power_supply; ret=%d\n" , ret); - goto err_close; + goto err_io_stop; } ret =joycon_input_create (ctlr);if (ret) {hid_err (hdev,"Failed to create input device; ret=%d\n" , ret); - goto err_close; + goto err_io_stop; } ctlr->ctlr_state =JOYCON_CTLR_STATE_READ ;
@@ -2380,7 +2380,8 @@ static int nintendo_hid_probe(struct hid_device *hdev,hid_dbg (hdev,"probe - success\n" );return 0 ; -err_close: +err_io_stop: +hid_device_io_stop (hdev);hid_hw_close (hdev); err_stop:hid_hw_stop (hdev);
Signature · 1 line
2.53.0