]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
genirq/timings: Prevent potential array overflow in __irq_timings_store()
authorBen Dai <ben.dai@unisoc.com>
Sun, 25 Apr 2021 15:09:03 +0000 (23:09 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 24 Sep 2021 10:27:35 +0000 (12:27 +0200)
commit0bf69327e4cfa51d4e95e2c0dfdd9fc683c88c1a
tree6901978ed6339aefbb5c76411a4df517a58ae3d0
parent1b02865ab1b25fb7e0ad1f8cac0c5fe42087c1ba
genirq/timings: Prevent potential array overflow in __irq_timings_store()

BugLink: https://bugs.launchpad.net/bugs/1944202
commit b9cc7d8a4656a6e815852c27ab50365009cb69c1 upstream.

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: 23aa3b9a6b7d ("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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
kernel/irq/timings.c