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

* Re: [PATCH] fix: drivers/usb/serial: usb_console_setup: unmatched usb_serial_put on error paths
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hovold @ 2026-07-06 11:55 UTC (permalink / raw)
  To: WenTao Liang; +Cc: gregkh, linux-usb, linux-kernel, stable

On Sat, Jun 27, 2026 at 11:34:10AM +0800, WenTao Liang wrote:
> 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.

No, there's a reference taken in usb_serial_port_get_by_minor() so this
patch would introduce an imbalance.

How are you coming up with these patches? Are you using an LLM? Why is
that not documented as required?

And why haven't you sent the follow-up mail telling maintainers to
ignore your patches as Greg asked you to do? [1]

Also I sent you review comments on other USB patches a month ago which
you still haven't replied to.

If you keep this up, you and your "lab" (why are you all using the same
mail address?) might end up banned as you've already been warned.

> Cc: stable@vger.kernel.org
> Fixes: 61dfa797c731 ("USB: serial: console: move mutex_unlock() before usb_serial_put()")

What on earth does this commit have to do with anything?

> Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>

Johan


[1] https://lore.kernel.org/all/2026062704-detail-machine-270f@gregkh/

^ permalink raw reply	[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