]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
rtc: disable uie before setting time and enable after
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Sun, 20 Oct 2019 23:13:20 +0000 (01:13 +0200)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:23:05 +0000 (14:23 -0300)
commitbe2063280b82447253c4b91d20b57c25f0a26579
tree43a2a72bcd4fcb9492310aa673388618ff7d2392
parent24983a8c9a966fd8e23611a5d6a12f3633dd3c76
rtc: disable uie before setting time and enable after

BugLink: https://bugs.launchpad.net/bugs/1857158
commit 7e7c005b4b1f1f169bcc4b2c3a40085ecc663df2 upstream.

When setting the time in the future with the uie timer enabled,
rtc_timer_do_work will loop for a while because the expiration of the uie
timer was way before the current RTC time and a new timer will be enqueued
until the current rtc time is reached.

If the uie timer is enabled, disable it before setting the time and enable
it after expiring current timers (which may actually be an alarm).

This is the safest thing to do to ensure the uie timer is still
synchronized with the RTC, especially in the UIE emulation case.

Reported-by: syzbot+08116743f8ad6f9a6de7@syzkaller.appspotmail.com
Fixes: 6610e0893b8b ("RTC: Rework RTC code to use timerqueue for events")
Link: https://lore.kernel.org/r/20191020231320.8191-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/rtc/interface.c