Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

serial: 8250: always disable IRQ during THRE test

commit 039d4926379b ("serial: 8250: Toggle IER bits on only after irq
has been set up") moved IRQ setup before the THRE test, in combination
with commit 205d300aea75 ("serial: 8250: change lock order in
serial8250_do_startup()") the interrupt handler can run during the
test and race with its IIR reads. This can produce wrong THRE test
results and cause spurious registration of the
serial8250_backup_timeout timer. Unconditionally disable the IRQ for
the short duration of the test and re-enable it afterwards to avoid
the race.

Fixes: 039d4926379b ("serial: 8250: Toggle IER bits on only after irq has been set up")
Depends-on: 205d300aea75 ("serial: 8250: change lock order in serial8250_do_startup()")
Cc: stable <stable@kernel.org>
Signed-off-by: Peng Zhang <zhangpeng.00@bytedance.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Alban Bedel <alban.bedel@lht.dlh.de>
Tested-by: Maximilian Lueer <maximilian.lueer@lht.dlh.de>
Link: https://patch.msgid.link/20260224121639.579404-1-alban.bedel@lht.dlh.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Peng Zhang and committed by
Greg Kroah-Hartman
24b98e86 a424a34b

+2 -4
+2 -4
drivers/tty/serial/8250/8250_port.c
··· 2147 2147 if (up->port.flags & UPF_NO_THRE_TEST) 2148 2148 return; 2149 2149 2150 - if (port->irqflags & IRQF_SHARED) 2151 - disable_irq_nosync(port->irq); 2150 + disable_irq(port->irq); 2152 2151 2153 2152 /* 2154 2153 * Test for UARTs that do not reassert THRE when the transmitter is idle and the interrupt ··· 2169 2170 serial_port_out(port, UART_IER, 0); 2170 2171 } 2171 2172 2172 - if (port->irqflags & IRQF_SHARED) 2173 - enable_irq(port->irq); 2173 + enable_irq(port->irq); 2174 2174 2175 2175 /* 2176 2176 * If the interrupt is not reasserted, or we otherwise don't trust the iir, setup a timer to