Skip to contentSkip to conversation

FAILED: patch "[PATCH] xhci: dbgtty: Fix unregister on tty_alloc_driver() failure" failed to apply to 5.10-stable tree

PATCH [email protected] 1 participant 1 message Aug 31

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.10-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-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 25b8dfc13495a6c1cf4abacc8ef20196c7f20e5c
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026083156-mortally-bountiful-0375@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 25b8dfc13495a6c1cf4abacc8ef20196c7f20e5c Mon Sep 17 00:00:00 2001
From: Lucas De Marchi <[email protected]>
Date: Thu, 6 Aug 2026 17:21:04 +0300
Subject: [PATCH] xhci: dbgtty: Fix unregister on tty_alloc_driver() failure

Make sure to set dbc_tty_driver to NULL to match the check in dbc_tty_exit(). For that, make detached error handling path common to the other branch in the same function.

Fixes 4521f1613940 ("xhci: dbctty: split dbc tty driver registration and unregistration functions.")
Cc Mathias Nyman <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
drivers/usb/host/xhci-dbgtty.c +11 -5
index 01decd46f313..7e44e62d6ea9 100644
@@ -628,8 +628,8 @@ int dbc_tty_init(void)
 	dbc_tty_driver = tty_alloc_driver(64, TTY_DRIVER_REAL_RAW |
 					  TTY_DRIVER_DYNAMIC_DEV);
 	if (IS_ERR(dbc_tty_driver)) {
-		idr_destroy(&dbc_tty_minors);
-		return PTR_ERR(dbc_tty_driver);
+		ret = PTR_ERR(dbc_tty_driver);
+		goto fail;
 	}
 
 	dbc_tty_driver->driver_name = "dbc_serial";
@@ -649,11 +649,17 @@ int dbc_tty_init(void)
 	ret = tty_register_driver(dbc_tty_driver);
 	if (ret) {
 		pr_err("Can't register dbc tty driver\n");
-		tty_driver_kref_put(dbc_tty_driver);
-		idr_destroy(&dbc_tty_minors);
-		dbc_tty_driver = NULL;
+		goto fail_put;
 	}
 
+	return ret;
+
+fail_put:
+	tty_driver_kref_put(dbc_tty_driver);
+fail:
+	idr_destroy(&dbc_tty_minors);
+	dbc_tty_driver = NULL;
+
 	return ret;
 }