Commit db0bbc90 authored by Yipeng Zou's avatar Yipeng Zou Committed by Yongqiang Liu
Browse files

genirq: add printk safe in irq context

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: bdc370d6 ("genirq: Introduce warn log when irq be reentrant")
Signed-off-by: default avatarYipeng Zou <zouyipeng@huawei.com>
Reviewed-by: default avatarLiao Chang <liaochang1@huawei.com>
Reviewed-by: default avatarZhang Jianhua <chris.zjh@huawei.com>
Signed-off-by: default avatarYongqiang Liu <liuyongqiang13@huawei.com>
parent e2c9c257
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -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