]> git.baikalelectronics.ru Git - kernel.git/commit
x86/i8259: Use printk_deferred() to prevent deadlock
authorThomas Gleixner <tglx@linutronix.de>
Wed, 29 Jul 2020 08:53:28 +0000 (10:53 +0200)
committerIngo Molnar <mingo@kernel.org>
Wed, 29 Jul 2020 14:27:16 +0000 (16:27 +0200)
commit166e04b3ce4ef26b6f35949e14ff762d87f77d50
treefa9b59260020434dace3e71beda74a527c6de7b8
parentcd194de09f766ecaa52d957318a77257f18d3584
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