]> git.baikalelectronics.ru Git - kernel.git/commit
timer: Fix wheel index calculation on last level
authorFrederic Weisbecker <frederic@kernel.org>
Fri, 17 Jul 2020 14:05:40 +0000 (16:05 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 17 Jul 2020 19:44:05 +0000 (21:44 +0200)
commit6cf64789c61e0061919d2ff26b01621c72779123
treec01504c4f71f0701226566f0ab859e5c9bd56097
parent936f83c21296f74d6afcb88c74e69eb2c77dcc1c
timer: Fix wheel index calculation on last level

When an expiration delta falls into the last level of the wheel, that delta
has be compared against the maximum possible delay and reduced to fit in if
necessary.

However instead of comparing the delta against the maximum, the code
compares the actual expiry against the maximum. Then instead of fixing the
delta to fit in, it sets the maximum delta as the expiry value.

This can result in various undesired outcomes, the worst possible one
being a timer expiring 15 days ahead to fire immediately.

Fixes: 2100cde1bed6 ("timers: Switch to a non-cascading wheel")
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20200717140551.29076-2-frederic@kernel.org
kernel/time/timer.c