]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
kevent: Fix an off-by-one in filt_timerexpire_l()
authorMark Johnston <markj@FreeBSD.org>
Wed, 25 May 2022 00:14:33 +0000 (20:14 -0400)
committerMark Johnston <markj@FreeBSD.org>
Wed, 8 Jun 2022 00:42:21 +0000 (20:42 -0400)
commit129112f80d2bfe6091ebb8656912fb55d6192e1f
treea85f017422279823a587b9aded784153eb81c68c
parentc87ff7f5c659ecab2c7092dd81c4a981d001f9f4
kevent: Fix an off-by-one in filt_timerexpire_l()

Suppose a periodic kevent timer fires close to its deadline, so that
now - kc->next is small.  Then delta ends up being 1, and the next timer
deadline is set to (delta + 1) * kc->to, where kc->to is the timer
period.  This means that the timer fires at half of the requested rate,
and the value returned in kn_data is similarly inaccurate.

PR: 264131
Fixes: 7cb40543e964 ("filt_timerexpire: do not iterate over the interval")
Reviewed by: kib
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 524dadf7a8725dea144571843e611dbdbd59d668)
sys/kern/kern_event.c