Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@kernel.org>
To: "Łukasz Bartosik" <ukaszb@chromium.org>,
	"Mathias Nyman" <mathias.nyman@intel.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2] xhci: dbgtty: fix device unregister
Date: Mon, 24 Nov 2025 07:42:32 +0100	[thread overview]
Message-ID: <2f05eedd-f152-4a4a-bf6c-09ca1ab7da40@kernel.org> (raw)
In-Reply-To: <20251119212910.1245694-1-ukaszb@google.com>

Hmm, CCing TTY MAINTAINERS entry would not hurt.

On 19. 11. 25, 22:29, Łukasz Bartosik wrote:
> From: Łukasz Bartosik <ukaszb@chromium.org>
> 
> When DbC is disconnected then xhci_dbc_tty_unregister_device()
> is called. However if there is any user space process blocked
> on write to DbC terminal device then it will never be signalled
> and thus stay blocked indifinitely.

indefinitely

> This fix adds a tty_vhangup() call in xhci_dbc_tty_unregister_device().
> The tty_vhangup() wakes up any blocked writers and causes subsequent
> write attempts to DbC terminal device to fail.
> 
> Cc: stable@vger.kernel.org
> Fixes: dfba2174dc42 ("usb: xhci: Add DbC support in xHCI driver")
> Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org>
> ---
> Changes in v2:
> - Replaced tty_hangup() with tty_vhangup()

Why exactly?

> --- a/drivers/usb/host/xhci-dbgtty.c
> +++ b/drivers/usb/host/xhci-dbgtty.c
> @@ -535,6 +535,12 @@ static void xhci_dbc_tty_unregister_device(struct xhci_dbc *dbc)
>   
>   	if (!port->registered)
>   		return;
> +	/*
> +	 * Hang up the TTY. This wakes up any blocked
> +	 * writers and causes subsequent writes to fail.
> +	 */
> +	tty_vhangup(port->port.tty);

This is wrong IMO:
1) what if there is no tty currently open? Ie. tty is NULL.
2) you schedule a tty hangup work and destroy the port right after:
>   	tty_unregister_device(dbc_tty_driver, port->minor);
>   	xhci_dbc_tty_exit_port(port);
>   	port->registered = false;
You should to elaborate how this is supposed to work?

thanks,
-- 
js
suse labs


  reply	other threads:[~2025-11-24  6:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-19 21:29 [PATCH v2] xhci: dbgtty: fix device unregister Łukasz Bartosik
2025-11-24  6:42 ` Jiri Slaby [this message]
2025-11-24  7:48   ` Mathias Nyman
2025-11-24  9:11     ` Jiri Slaby
2025-11-25  7:53       ` Łukasz Bartosik
2025-11-25  8:00         ` Greg Kroah-Hartman
2025-11-25 14:39           ` Łukasz Bartosik
2025-11-26  5:39             ` Jiri Slaby
2025-11-26  9:53               ` Łukasz Bartosik

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=2f05eedd-f152-4a4a-bf6c-09ca1ab7da40@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=ukaszb@chromium.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