stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [tip: x86/urgent] x86/i8259: Use printk_deferred() to prevent deadlock
       [not found] <87365abt2v.fsf@nanos.tec.linutronix.de>
@ 2020-07-29 14:33 ` tip-bot2 for Thomas Gleixner
  0 siblings, 0 replies; only message in thread
From: tip-bot2 for Thomas Gleixner @ 2020-07-29 14:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: kernel test robot, Thomas Gleixner, Ingo Molnar, stable, x86, LKML

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     bdd65589593edd79b6a12ce86b3b7a7c6dae5208
Gitweb:        https://git.kernel.org/tip/bdd65589593edd79b6a12ce86b3b7a7c6dae5208
Author:        Thomas Gleixner <tglx@linutronix.de>
AuthorDate:    Wed, 29 Jul 2020 10:53:28 +02:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Wed, 29 Jul 2020 16:27:16 +02:00

x86/i8259: Use printk_deferred() to prevent deadlock

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: kernel test robot <lkp@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/87365abt2v.fsf@nanos.tec.linutronix.de
---
 arch/x86/kernel/i8259.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c
index f3c7625..282b4ee 100644
--- a/arch/x86/kernel/i8259.c
+++ b/arch/x86/kernel/i8259.c
@@ -207,7 +207,7 @@ spurious_8259A_irq:
 		 * lets ACK and report it. [once per IRQ]
 		 */
 		if (!(spurious_irq_mask & irqmask)) {
-			printk(KERN_DEBUG
+			printk_deferred(KERN_DEBUG
 			       "spurious 8259A interrupt: IRQ%d.\n", irq);
 			spurious_irq_mask |= irqmask;
 		}

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-07-29 14:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87365abt2v.fsf@nanos.tec.linutronix.de>
2020-07-29 14:33 ` [tip: x86/urgent] x86/i8259: Use printk_deferred() to prevent deadlock tip-bot2 for Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).