From: Yipeng Zou zouyipeng@huawei.com
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I6BO2R CVE: NA
--------------------------------
The printk has the risk of deadlocks in the context of an interrupt.
Introduce printk safe to avoid it.
Fixes: bdc370d64dc4 ("genirq: Introduce warn log when irq be reentrant") Signed-off-by: Yipeng Zou zouyipeng@huawei.com Reviewed-by: Liao Chang liaochang1@huawei.com Reviewed-by: Zhang Jianhua chris.zjh@huawei.com Signed-off-by: Yongqiang Liu liuyongqiang13@huawei.com --- kernel/irq/chip.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index 39bed3e4da3c..6d5c1fe792b5 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c @@ -513,9 +513,19 @@ static bool irq_may_run(struct irq_desc *desc) if (!irqd_has_set(&desc->irq_data, mask)) return true;
- if (irqd_get(&desc->irq_data) & IRQD_IRQ_INPROGRESS) - pr_warn_ratelimited("irq %u(%lu) may be reentrant in multiple cpus.\n", - desc->irq_data.irq, desc->irq_data.hwirq); + if (irqd_get(&desc->irq_data) & IRQD_IRQ_INPROGRESS) { + const char *name = NULL; + + if (desc->name) + name = desc->name; + else if (desc->action) + name = desc->action->name; + + printk_safe_enter(); + pr_warn("irq %u(%s) may be reentrant in multiple cpus.\n", + desc->irq_data.irq, name == NULL ? "NULL" : name); + printk_safe_exit(); + }
/* * If the interrupt is an armed wakeup source, mark it pending