Skip to contentSkip to conversation

net: hso: fix TIOCMIWAIT race

PATCH Applied Johan Hovold 2 participants 2 messages Sep 7 – Sep 10

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: hso: fix TIOCMIWAIT race

The task state must be updated before checking the wakeup condition to avoid missing a racing modem status update.

Fixes 542f54823614 ("tty: Modem functions for the HSO driver")
Cc [email protected] # 2.6.29
---
 drivers/net/usb/hso.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/usb/hso.c +1 -1
index c1aec67688ae..71caa3764b23 100644
@@ -1547,10 +1547,10 @@ hso_wait_modem_status(struct hso_serial *serial, unsigned long arg)
 	spin_unlock_irq(&serial->serial_lock);
 	add_wait_queue(&tiocmget->waitq, &wait);
 	for (;;) {
+		set_current_state(TASK_INTERRUPTIBLE);
 		spin_lock_irq(&serial->serial_lock);
 		memcpy(&cnow, &tiocmget->icount, sizeof(struct uart_icount));
 		spin_unlock_irq(&serial->serial_lock);
-		set_current_state(TASK_INTERRUPTIBLE);
 		if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) ||
 		    ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) ||
 		    ((arg & TIOCM_CD)  && (cnow.dcd != cprev.dcd))) {
Signature · 1 line
2.55.0
#1 lore raw
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:

Quoted 8 lines · On Mon, 7 Sep 2026 08:52:35 +0200 you wrote:

The task state must be updated before checking the wakeup condition to avoid missing a racing modem status update.

Fixes 542f54823614 ("tty: Modem functions for the HSO driver")
Cc [email protected] # 2.6.29

[...]

Here is the summary with links:
- [net] net: hso: fix TIOCMIWAIT race

    https://git.kernel.org/netdev/net/c/00f9fbc12320

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html