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 173BD4A5ED9; Mon, 31 Aug 2026 13:44:28 +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=1788183870; cv=none; b=Lt1C7+tr51bkyfjAz5tUKeN2Fji/IiQHhuxqrvQxyP+N0ysufVx9bCGQMnBvgT6LOVMJhx5+9Sbmbje2IGTOXUS8CW/xZxNJx9jds7cf8uzUceaBGTYhdks4amGqfbYz/LCvynE6nFYWG/N8ItcpnxLBZRR2EoqhoLGa51lWnbM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788183870; c=relaxed/simple; bh=eKdlmggEZAJ7tgR/LJrWoehw4xssjpWoAexsKsyVjSg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j/dKhDs/wErMwWqrzi6zT0d8PYPSjdAfcEAnZIG7a3jhpke+f4+1rXWm1ibpn9W2b5FjHo/JDUsAOA/WGfnnqHIW7DpLLKvKgFViRdrNJvP/+nwBbTspsD1oiU2FNmhvD70QHZWrRWBOCPwiyWB5rWHDd+BKNrSgXbmYqSL+hRE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=tzc4YxAb; 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="tzc4YxAb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 657D61F00A3D; Mon, 31 Aug 2026 13:44:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788183867; bh=hQyEYKqJQyM9OrStiLYWrJaH6W+Dx8uLJpSuM18tKE8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=tzc4YxAb6eincXE+iYbxtbT4oVYMaT8I6yUr5hoA2CtODsH4U+lwFnsLMWCm2Dwuz 2UESywCpDpSNTSV+OYwTx1ZkrO7QZDkdSAq+hKkGAqpAnVV5S7nVpbg5qpbaTZXerH ZBij5QzDAjR3yItxzJX0T2vzde5DBfnFPecQsNJE= 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.1 24/76] xhci: dbgtty: Fix unregister on tty_alloc_driver() failure Date: Mon, 31 Aug 2026 15:33:56 +0200 Message-ID: <20260831133400.517817039@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260831133359.185608553@linuxfoundation.org> References: <20260831133359.185608553@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.1-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)