Re: [PATCH v3] serial: 8250: always disable IRQ during THRE test

From: Jiri Slaby

Date: Thu Feb 12 2026 - 03:42:57 EST


On 09. 02. 26, 12:32, Alban Bedel wrote:
From: Peng Zhang <zhangpeng.00@xxxxxxxxxxxxx>

commit 039d4926379b ("serial: 8250: Toggle IER bits on only after irq
has been set up") moved IRQ setup before the THRE test, so 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.

Cc: stable@xxxxxxxxxxxxxxx
Fixes: 039d4926379b ("serial: 8250: Toggle IER bits on only after irq has been set up")
Signed-off-by: Peng Zhang <zhangpeng.00@xxxxxxxxxxxxx>
Reviewed-by: Muchun Song <songmuchun@xxxxxxxxxxxxx>
Signed-off-by: Alban Bedel <alban.bedel@xxxxxxxxxx>
Tested-by: Maximilian Lueer <maximilian.lueer@xxxxxxxxxx>
---
Changelog:

v2: Replaced disable_irq_nosync() with disable_irq() to prevent interrupts
that are currently being handled

This made me to check, why/how this is possible. It appears to be, but only thanks to:
205d300aea75 serial: 8250: change lock order in serial8250_do_startup()

And the change should be documented in the commit log. Especially to avoid stable backports to trees without 205d300aea75.

thanks,
--
js
suse labs