From 28c93bc1f7e516495313e18e829c89fec0cb4dcc Mon Sep 17 00:00:00 2001 From: Wei Li Date: Thu, 14 Feb 2019 22:27:12 +0800 Subject: [PATCH] genirq:fix concurrency issue in NMI counter hulk inclusion category: bugfix bugzilla: 9298 CVE: NA ------------------------------------------------- Incrementing the percpu kstat.irqs_sum is not safe in an NMI context as we could have interrupted and interrupt trying to increment that same counter. Signed-off-by: Wei Li Reviewed-by: Hanjun Guo Signed-off-by: Yang Yingliang --- kernel/irq/chip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index 87afc1f0f493..91d349ae0738 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c @@ -748,7 +748,7 @@ void handle_fasteoi_nmi(struct irq_desc *desc) unsigned int irq = irq_desc_get_irq(desc); irqreturn_t res; - kstat_incr_irqs_this_cpu(desc); + this_cpu_inc(*desc->kstat_irqs); trace_irq_handler_entry(irq, action); /* * NMIs cannot be shared, there is only one action. @@ -955,7 +955,7 @@ void handle_percpu_devid_fasteoi_nmi(struct irq_desc *desc) unsigned int irq = irq_desc_get_irq(desc); irqreturn_t res; - kstat_incr_irqs_this_cpu(desc); + this_cpu_inc(*desc->kstat_irqs); trace_irq_handler_entry(irq, action); res = action->handler(irq, raw_cpu_ptr(action->percpu_dev_id)); trace_irq_handler_exit(irq, action, res); -- GitLab