]> 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, 25 May 2022 00:14:33 +0000 (20:14 -0400)
commit524dadf7a8725dea144571843e611dbdbd59d668
tree7b1388daab8e501a5e94d6692b631695f2caa352
parentc728c56c870abe230e45cee5c477f0d890ebacef
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
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35313
sys/kern/kern_event.c