From: Jiri Slaby <jirislaby@kernel.org>
To: "Mathias Nyman" <mathias.nyman@linux.intel.com>,
"Ł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 10:11:04 +0100 [thread overview]
Message-ID: <e7ebc1da-1a94-4465-bc79-de9ad8ba1cb6@kernel.org> (raw)
In-Reply-To: <6171754f-1b84-47e0-a4da-0d045ea7546e@linux.intel.com>
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.
>>
>> 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?
>
> 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.
thanks,
--
js
suse labs
next prev parent reply other threads:[~2025-11-24 9:11 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 [this message]
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=e7ebc1da-1a94-4465-bc79-de9ad8ba1cb6@kernel.org \
--to=jirislaby@kernel.org \
--cc=gregkh@linuxfoundation.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