From: WenTao Liang <vulab@iscas.ac.cn>
To: johan@kernel.org, gregkh@linuxfoundation.org
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
WenTao Liang <vulab@iscas.ac.cn>,
stable@vger.kernel.org
Subject: [PATCH] fix: drivers/usb/serial: usb_console_setup: unmatched usb_serial_put on error paths
Date: Sat, 27 Jun 2026 11:34:10 +0800 [thread overview]
Message-ID: <20260627033410.58709-1-vulab@iscas.ac.cn> (raw)
In usb_console_setup(), serial is obtained via a simple pointer
assignment (port->serial) which does not increment the reference count.
However, all error paths that reach error_get_interface call
usb_serial_put(serial), decrementing a reference that was never acquired
within the function. This causes a refcount underflow on the serial
device.
Remove the unmatched usb_serial_put(serial) call from the error path.
Cc: stable@vger.kernel.org
Fixes: 61dfa797c731 ("USB: serial: console: move mutex_unlock() before usb_serial_put()")
Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>
---
drivers/usb/serial/console.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
index 29f09190846e..e97520cdc43d 100644
--- a/drivers/usb/serial/console.c
+++ b/drivers/usb/serial/console.c
@@ -190,7 +190,6 @@ static int usb_console_setup(struct console *co, char *options)
usb_autopm_put_interface(serial->interface);
error_get_interface:
mutex_unlock(&serial->disc_mutex);
- usb_serial_put(serial);
return retval;
}
--
2.39.5 (Apple Git-154)
next reply other threads:[~2026-06-27 3:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-27 3:34 WenTao Liang [this message]
2026-07-06 11:55 ` Johan Hovold
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=20260627033410.58709-1-vulab@iscas.ac.cn \
--to=vulab@iscas.ac.cn \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®