Commit 0ee3da56 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Kelsey Skunberg

x86/i8259: Use printk_deferred() to prevent deadlock

BugLink: https://bugs.launchpad.net/bugs/1892822

commit bdd65589 upstream.

0day reported a possible circular locking dependency:

Chain exists of:
  &irq_desc_lock_class --> console_owner --> &port_lock_key

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&port_lock_key);
                               lock(console_owner);
                               lock(&port_lock_key);
  lock(&irq_desc_lock_class);

The reason for this is a printk() in the i8259 interrupt chip driver
which is invoked with the irq descriptor lock held, which reverses the
lock operations vs. printk() from arbitrary contexts.

Switch the printk() to printk_deferred() to avoid that.
Reported-by: default avatarkernel test robot <lkp@intel.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/87365abt2v.fsf@nanos.tec.linutronix.deSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarIan May <ian.may@canonical.com>
Signed-off-by: default avatarKelsey Skunberg <kelsey.skunberg@canonical.com>
parent aacbbe0b
...@@ -205,7 +205,7 @@ static void mask_and_ack_8259A(struct irq_data *data) ...@@ -205,7 +205,7 @@ static void mask_and_ack_8259A(struct irq_data *data)
* lets ACK and report it. [once per IRQ] * lets ACK and report it. [once per IRQ]
*/ */
if (!(spurious_irq_mask & irqmask)) { if (!(spurious_irq_mask & irqmask)) {
printk(KERN_DEBUG printk_deferred(KERN_DEBUG
"spurious 8259A interrupt: IRQ%d.\n", irq); "spurious 8259A interrupt: IRQ%d.\n", irq);
spurious_irq_mask |= irqmask; spurious_irq_mask |= irqmask;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment