From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 70A2443F095; Mon, 31 Aug 2026 13:37:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788183472; cv=none; b=pu+YDGeFUFo1fFaiS/NbSR4kizmYQgJPFNScs9DRP1y/h7F/Obon5xUfihEL7uAbMNR54DYYDPtteVf0fK9HVIuY8JyUIZ9yBNSvZhbenGvMe+J1kg1LLxnx97QxF+Bh9biRVPnUNcHXtVvJDFYb/TeeFNFRT24FjaEroXk7Y+8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788183472; c=relaxed/simple; bh=tvIamzYlXuGtprJ6NesyqVIwSyiHg+Px3Gncmn7KchQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=I6tDLjxn3MeNUDfsOZ7ELdhEcwzUKhPDCSku3bbecKyrJO0q8i1QMn2gCoTyVaDAJ+DPcO57cWve6GXl+wFcB3Smh6uDaJu3FV68lNonriK0RcqayL60LXc2e+6Q3K7OeMejnNwRt3d4V7jgbbCoRNg7oJAnaye4j6OguUloJHA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=dJhcneEP; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="dJhcneEP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B468A1F00A3D; Mon, 31 Aug 2026 13:37:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788183471; bh=bgG27PGwDlRV6GWfOgZ76peL2Ep3mnWuJkcuDO/bm5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dJhcneEPbYYCl/xqOH9l+RZqO8yXar3KxW6GKQ+JIth19cOLqCcd6yaFHDpAZd4n+ qk8ZDbTEvseafY9oq5xPafafG04ZPaGOm6LuRTyJQjozBMFposq41y19XzIiuU1KQd zKT0MXcq3PXCx7g6+iIgTDbQtP7Pzn7t4pctq7OU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mathias Nyman , Lucas De Marchi Subject: [PATCH 7.2 11/71] xhci: dbgtty: Fix unregister on tty_alloc_driver() failure Date: Mon, 31 Aug 2026 15:33:36 +0200 Message-ID: <20260831133359.555811646@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260831133359.055927882@linuxfoundation.org> References: <20260831133359.055927882@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.2-stable review patch. If anyone has any objections, please let me know. ------------------ From: Lucas De Marchi commit 25b8dfc13495a6c1cf4abacc8ef20196c7f20e5c upstream. 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: stable@vger.kernel.org # v5.10 Cc: Mathias Nyman Cc: Greg Kroah-Hartman Signed-off-by: Lucas De Marchi Signed-off-by: Mathias Nyman Link: https://patch.msgid.link/20260806142113.2436238-9-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/xhci-dbgtty.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) --- a/drivers/usb/host/xhci-dbgtty.c +++ b/drivers/usb/host/xhci-dbgtty.c @@ -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,12 +649,18 @@ 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; } void dbc_tty_exit(void)