Re: [PATCH v2] parport: do not re-enable interrupts in parport_claim()

From: Greg Kroah-Hartman

Date: Wed Nov 18 2026 - 03:11:43 EST


Wait, your subject makes no sense.

On Wed, Nov 18, 2026 at 03:58:16PM +0800, Ziheng Wei wrote:
> 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

but that's not why spin_lock/unlock_irq() is being called, it's because
this lock could be held _during_ an irq path, right?

Are you saying that this lock is never held in irq context?


> |
> +---- 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

Ok, but again, you have to look at the lock itself, is the
waitlist_lock() ever held in irq context?

thanks,

greg k-h