mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
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: 542f548236 ("tty: Modem functions for the HSO driver")
Cc: stable@vger.kernel.org # 2.6.29
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20260907065235.100848-1-johan@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
7f26a5e804
commit
00f9fbc123
|
|
@ -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))) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user