From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: "Łukasz Bartosik" <ukaszb@chromium.org>
Cc: Jiri Slaby <jirislaby@kernel.org>,
Mathias Nyman <mathias.nyman@linux.intel.com>,
Mathias Nyman <mathias.nyman@intel.com>,
linux-usb@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2] xhci: dbgtty: fix device unregister
Date: Tue, 25 Nov 2025 09:00:53 +0100 [thread overview]
Message-ID: <2025112537-purgatory-delegator-41fb@gregkh> (raw)
In-Reply-To: <CALwA+NakWZSY-NOebF9E+gGPf2p0Y5FLOZcpLfSbt5zkNm_qxQ@mail.gmail.com>
On Tue, Nov 25, 2025 at 08:53:17AM +0100, Łukasz Bartosik wrote:
> On Mon, Nov 24, 2025 at 10:11 AM Jiri Slaby <jirislaby@kernel.org> wrote:
> >
> > On 24. 11. 25, 8:48, Mathias Nyman wrote:
> > > On 11/24/25 08:42, Jiri Slaby wrote:
> > >> Hmm, CCing TTY MAINTAINERS entry would not hurt.
> > >>
>
> Fair point. I will keep it in mind in the future.
>
> > >> 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
> > >>
>
> Thanks for spotting this.
>
> > >>> 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?
> > >
> > > I recommended using tty_vhangup(), well actually tty_port_tty_vhangup()
> > > to solve
> > > issue '2' you pointed out.
> > > To me it looks like tty_vhangup() is synchronous so it won't schedule
> > > hangup work
> > > and should be safe to call right before we destroy the port.
> >
> > Oops, right, my cscope DB was old and lead me to tty_hangup() instead
> > (that schedules).
> >
> > >> 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?
> > >
> > > Does tty_port_tty_vhangup() work here? it
> > > 1. checks if tty is NULL
> > > 2. is synchronous and should be safe to call before tty_unregister_device()
> >
> > Yes, this works for me.
> >
>
> Greg should I send v3 with typo fix indifinitely -> indefinitely and
> elaborate on
> the tty_hangup() -> tty_vhangup() replacement in changes ?
As this is already in my tree, a fixup on top of that would be good.
thanks,
greg k-h
next prev parent reply other threads:[~2025-11-25 8:00 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
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 [this message]
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=2025112537-purgatory-delegator-41fb@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=mathias.nyman@linux.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