提交 4b50cb05 编写于 作者: T Thomas Gleixner 提交者: Yang Yingliang

genirq/debugfs: Add missing sanity checks to interrupt injection

mainline inclusion
from mainline-v5.6
commit a740a423
category: bugfix
bugzilla: 32425
CVE: NA

-------------------

Interrupts cannot be injected when the interrupt is not activated and when
a replay is already in progress.

Fixes: 536e2e34 ("genirq/debugfs: Triggering of interrupts from userspace")
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
Acked-by: NMarc Zyngier <maz@kernel.org>
Link: https://lkml.kernel.org/r/20200306130623.500019114@linutronix.deSigned-off-by: NYuan Can <yuancan@huawei.com>
Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 62834c28
......@@ -206,8 +206,15 @@ static ssize_t irq_debug_write(struct file *file, const char __user *user_buf,
chip_bus_lock(desc);
raw_spin_lock_irqsave(&desc->lock, flags);
if (irq_settings_is_level(desc) || desc->istate & IRQS_NMI) {
/* Can't do level nor NMIs, sorry */
/*
* Don't allow injection when the interrupt is:
* - Level or NMI type
* - not activated
* - replaying already
*/
if (irq_settings_is_level(desc) ||
!irqd_is_activated(&desc->irq_data) ||
(desc->istate & (IRQS_NMI | IRQS_REPLAY))) {
err = -EINVAL;
} else {
desc->istate |= IRQS_PENDING;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册