Linux USB
 help / color / mirror / Atom feed
* [PATCH] fix: drivers/usb/serial: usb_console_setup: unmatched usb_serial_put on error paths
@ 2026-06-27  3:34 WenTao Liang
  2026-07-06 11:55 ` Johan Hovold
  0 siblings, 1 reply; 2+ messages in thread
From: WenTao Liang @ 2026-06-27  3:34 UTC (permalink / raw)
  To: johan, gregkh; +Cc: linux-usb, linux-kernel, WenTao Liang, stable

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)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-06 11:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-27  3:34 [PATCH] fix: drivers/usb/serial: usb_console_setup: unmatched usb_serial_put on error paths WenTao Liang
2026-07-06 11:55 ` Johan Hovold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox