Skip to contentSkip to conversation

xhci: dbgtty: fix device unregister: fixup typo

PATCH In review Łukasz Bartosik 4 participants 10 messages Nov 25, 2025 – Nov 27, 2025 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xhci: dbgtty: fix device unregister: fixup typo

From: Łukasz Bartosik <[email protected]>

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 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.

Fixes dfba2174dc42 ("usb: xhci: Add DbC support in xHCI driver")

Fix typo indifinitely->indefinitely

--
2.52.0.460.gd25c4c69ec-goog

#1 lore raw
Quoted 11 lines · Łukasz Bartosik

From: Łukasz Bartosik <[email protected]>

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 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.

Quoted 9 lines
Fixes dfba2174dc42 ("usb: xhci: Add DbC support in xHCI driver")

Fix typo indifinitely->indefinitely

--
2.52.0.460.gd25c4c69ec-goog

I see no patch here :(

#2 lore raw
Quoted 17 lines · Greg Kroah-Hartman
Quoted 15 lines · Łukasz Bartosik

From: Łukasz Bartosik <[email protected]>

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 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.

Fixes dfba2174dc42 ("usb: xhci: Add DbC support in xHCI driver")
Quoted 7 lines
Quoted 5 lines

Fix typo indifinitely->indefinitely

--
2.52.0.460.gd25c4c69ec-goog

I see no patch here :(

Hi Greg,

The typo I fixed was in the commit message indifinitely->indefinitely.

Would you please elaborate what is your expectation for a fixup in this case ?

Thanks,
Łukasz

#3 lore raw
Quoted 25 lines · Łukasz Bartosik
Quoted 23 lines · Greg Kroah-Hartman
Quoted 20 lines · Łukasz Bartosik

From: Łukasz Bartosik <[email protected]>

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 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.

Fixes dfba2174dc42 ("usb: xhci: Add DbC support in xHCI driver")

Fix typo indifinitely->indefinitely

--
2.52.0.460.gd25c4c69ec-goog

Quoted 8 lines
Quoted 1 line

I see no patch here :(

Hi Greg,

The typo I fixed was in the commit message indifinitely->indefinitely.

Would you please elaborate what is your expectation for a fixup in this case ?

A fixup patch is just a new patch that is applied on top of the first.

If the typo was in the commit message then it can't be helped.

I still think we need a fixup patch for the missing null check

- tty_vhangup(port->port.tty);
+ if (port->port.tty)
+ tty_vhangup(port->port.tty);

or just use tty_port_tty_vhangup()

Remember to add Jiri Slaby and stable to CC, and a new Fixes tag

Fixes 1f73b8b56cf3 ("xhci: dbgtty: fix device unregister")

Thanks
Mathias

#4 lore raw
Quoted 29 lines · Mathias Nyman
Quoted 27 lines · Łukasz Bartosik
Quoted 24 lines · Greg Kroah-Hartman
Quoted 11 lines · Łukasz Bartosik

From: Łukasz Bartosik <[email protected]>

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 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.

Quoted 9 lines
Fixes dfba2174dc42 ("usb: xhci: Add DbC support in xHCI driver")

Fix typo indifinitely->indefinitely

--
2.52.0.460.gd25c4c69ec-goog

I see no patch here :(

Quoted 9 lines
Quoted 6 lines

Hi Greg,

The typo I fixed was in the commit message indifinitely->indefinitely.

Would you please elaborate what is your expectation for a fixup in this case ?

A fixup patch is just a new patch that is applied on top of the first.

Thank you for the clarification.

Quoted 2 lines

If the typo was in the commit message then it can't be helped.

:(

Quoted 8 lines

I still think we need a fixup patch for the missing null check

(quoted diff) +2 -1
-       tty_vhangup(port->port.tty);
+       if (port->port.tty)
+               tty_vhangup(port->port.tty);

or just use tty_port_tty_vhangup()

IMHO it looks good because tty_vhangup calls two functions inside:
1) tty_debug_hangup - which handles the case when tty is null
2) __tty_hangup - which also checks tty for null

Thanks,
Łukasz

Quoted 7 lines

Remember to add Jiri Slaby and stable to CC, and a new Fixes tag

Fixes 1f73b8b56cf3 ("xhci: dbgtty: fix device unregister")

Thanks
Mathias

#5 lore raw
Quoted 6 lines · Łukasz Bartosik
Quoted 6 lines

I still think we need a fixup patch for the missing null check

(quoted diff) +2 -1
-       tty_vhangup(port->port.tty);
+       if (port->port.tty)
+               tty_vhangup(port->port.tty);
Quoted 6 lines
Quoted 2 lines

or just use tty_port_tty_vhangup()

IMHO it looks good because tty_vhangup calls two functions inside:
1) tty_debug_hangup - which handles the case when tty is null
2) __tty_hangup - which also checks tty for null

Is it still good when someone closes the TTY right after the "if (!tty)" checks?

thanks,

Signature · 2 lines
js
suse labs
#6 lore raw
Quoted 11 lines · Jiri Slaby
Quoted 9 lines · Łukasz Bartosik
Quoted 8 lines

I still think we need a fixup patch for the missing null check

(quoted diff) +2 -1
-       tty_vhangup(port->port.tty);
+       if (port->port.tty)
+               tty_vhangup(port->port.tty);

or just use tty_port_tty_vhangup()

Quoted 7 lines
Quoted 3 lines

IMHO it looks good because tty_vhangup calls two functions inside:
1) tty_debug_hangup - which handles the case when tty is null
2) __tty_hangup - which also checks tty for null

Is it still good when someone closes the TTY right after the "if (!tty)" checks?

Hi Jiri,

Will putting tty_vhangup around get and put reference as follows suffice:
tty = tty_port_tty_get(port);

if (tty) {
    tty_vhangup(tty);
    tty_kref_put(tty);
}

Thanks,
Łukasz

Quoted 4 lines

thanks,
--
js
suse labs

#7 lore raw
Quoted 21 lines · Łukasz Bartosik
Quoted 11 lines · Jiri Slaby
Quoted 9 lines · Łukasz Bartosik
Quoted 8 lines

I still think we need a fixup patch for the missing null check

(quoted diff) +2 -1
-       tty_vhangup(port->port.tty);
+       if (port->port.tty)
+               tty_vhangup(port->port.tty);

or just use tty_port_tty_vhangup()

Quoted 7 lines
Quoted 3 lines

IMHO it looks good because tty_vhangup calls two functions inside:
1) tty_debug_hangup - which handles the case when tty is null
2) __tty_hangup - which also checks tty for null

Is it still good when someone closes the TTY right after the "if (!tty)" checks?

Quoted 9 lines

Hi Jiri,

Will putting tty_vhangup around get and put reference as follows suffice:
tty = tty_port_tty_get(port);

if (tty) {
    tty_vhangup(tty);
    tty_kref_put(tty);
}

Ah I missed what already Mathias pointed out to me in the comment
https://lore.kernel.org/all/[email protected]/
that there is a helper tty_port_tty_vhangup which takes care of the locking as well.

I will send a fixup which switches tty_vhangup -> tty_port_tty_vhangup.

Thanks,
Łukasz

Quoted 7 lines

Thanks,
Łukasz

Quoted 4 lines

thanks,
--
js
suse labs

#8 lore raw
Quoted 33 lines · Łukasz Bartosik
Quoted 21 lines · Łukasz Bartosik
Quoted 11 lines · Jiri Slaby
Quoted 9 lines · Łukasz Bartosik
Quoted 8 lines

I still think we need a fixup patch for the missing null check

(quoted diff) +2 -1
-       tty_vhangup(port->port.tty);
+       if (port->port.tty)
+               tty_vhangup(port->port.tty);

or just use tty_port_tty_vhangup()

Quoted 7 lines
Quoted 3 lines

IMHO it looks good because tty_vhangup calls two functions inside:
1) tty_debug_hangup - which handles the case when tty is null
2) __tty_hangup - which also checks tty for null

Is it still good when someone closes the TTY right after the "if (!tty)" checks?

Quoted 9 lines

Hi Jiri,

Will putting tty_vhangup around get and put reference as follows suffice:
tty = tty_port_tty_get(port);

if (tty) {
    tty_vhangup(tty);
    tty_kref_put(tty);
}
Quoted 7 lines

Ah I missed what already Mathias pointed out to me in the comment
https://lore.kernel.org/all/[email protected]/
that there is a helper tty_port_tty_vhangup which takes care of the locking as well.

I will send a fixup which switches tty_vhangup -> tty_port_tty_vhangup.

I sent the fixup
https://lore.kernel.org/linux-usb/[email protected]/T/

Thank you,
Łukasz

Quoted 10 lines

Thanks,
Łukasz

Quoted 7 lines

Thanks,
Łukasz

Quoted 4 lines

thanks,
--
js
suse labs

#9 lore raw
In reply to Łukasz Bartosik
Quoted 25 lines · Łukasz Bartosik
Quoted 23 lines · Greg Kroah-Hartman
Quoted 20 lines · Łukasz Bartosik

From: Łukasz Bartosik <[email protected]>

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 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.

Fixes dfba2174dc42 ("usb: xhci: Add DbC support in xHCI driver")

Fix typo indifinitely->indefinitely

--
2.52.0.460.gd25c4c69ec-goog

Quoted 7 lines
Quoted 1 line

I see no patch here :(

Hi Greg,

The typo I fixed was in the commit message indifinitely->indefinitely.

Would you please elaborate what is your expectation for a fixup in this case ?

Ah, I thought it was a change to the diff. We can't change changelogs after they are in the tree, sorry.

thanks,

greg k-h