When the claiming device was on the wait list, parport_claim() takes it off the list with spin_lock_irq()/spin_unlock_irq() while it holds cad_lock with interrupts disabled: parport_claim() | | write_lock_irqsave(&port->cad_lock) <- IRQs off, cad_lock held | spin_lock_irq(&port->waitlist_lock) | spin_unlock_irq(&port->waitlist_lock) <- IRQs on too early | +---- port interrupt on this CPU ----+ | | | v | parport_irq_handler() | read_lock(&port->cad_lock) | spins forever: cad_lock is held | by the code it interrupted | | write_unlock_irqrestore(&port->cad_lock) <- never reached Interrupts are already disabled here, so use spin_lock()/spin_unlock(), like the "blocked" path in the same function. Found by LLM-assisted static analysis. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Signed-off-by: Ziheng Wei --- Notes: v2: shorter changelog; drop the kernel test robot tags. The bug was found by the static analysis above. The kernel test robot had sent a smatch warning for the same code to oe-kbuild only, which I found afterwards and credited in v1: https://lore.kernel.org/r/202608091622.jlJn0jOj-lkp@intel.com/ Tested in QEMU (parport_pc) with two ppdev users, one waiting in PPCLAIM while the other releases the port: lockdep warns without this patch and is quiet with it. I have no parallel port hardware. On real hardware this needs two users of the same port and a port interrupt within a few microseconds of the hand-over, so it is unlikely to be hit; lockdep reports it whenever the path runs. The changelog was drafted with an AI assistant and reviewed by me. drivers/parport/share.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/parport/share.c b/drivers/parport/share.c index eb0977ca1..d1b9f17d1 100644 --- a/drivers/parport/share.c +++ b/drivers/parport/share.c @@ -999,7 +999,7 @@ int parport_claim(struct pardevice *dev) dev->waiting = 0; /* Take ourselves out of the wait list again. */ - spin_lock_irq(&port->waitlist_lock); + spin_lock(&port->waitlist_lock); if (dev->waitprev) dev->waitprev->waitnext = dev->waitnext; else @@ -1008,7 +1008,7 @@ int parport_claim(struct pardevice *dev) dev->waitnext->waitprev = dev->waitprev; else port->waittail = dev->waitprev; - spin_unlock_irq(&port->waitlist_lock); + spin_unlock(&port->waitlist_lock); dev->waitprev = dev->waitnext = NULL; } base-commit: 97d73c8251226cf27cc6656b4c542869bb8c69fa -- 2.43.0