mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 14:04:54 +02:00
genirq/timings: Prevent potential array overflow in __irq_timings_store()
commitb9cc7d8a46upstream. When the interrupt interval is greater than 2 ^ PREDICTION_BUFFER_SIZE * PREDICTION_FACTOR us and less than 1s, the calculated index will be greater than the length of irqs->ema_time[]. Check the calculated index before using it to prevent array overflow. Fixes:23aa3b9a6b("genirq/timings: Encapsulate storing function") Signed-off-by: Ben Dai <ben.dai@unisoc.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20210425150903.25456-1-ben.dai9703@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
355754194b
commit
2d2c668480
|
|
@ -453,6 +453,11 @@ static __always_inline void __irq_timings_store(int irq, struct irqt_stat *irqs,
|
||||||
*/
|
*/
|
||||||
index = irq_timings_interval_index(interval);
|
index = irq_timings_interval_index(interval);
|
||||||
|
|
||||||
|
if (index > PREDICTION_BUFFER_SIZE - 1) {
|
||||||
|
irqs->count = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Store the index as an element of the pattern in another
|
* Store the index as an element of the pattern in another
|
||||||
* circular array.
|
* circular array.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user