]> git.hungrycats.org Git - linux/commit
rtc: check if __rtc_read_time was successful in rtc_timer_do_work()
authorYongliang Gao <leonylgao@tencent.com>
Fri, 11 Oct 2024 04:31:53 +0000 (12:31 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2024 12:54:27 +0000 (13:54 +0100)
commita1f0b4af90cc18b10261ecde56c6a56b22c75bd1
tree4f00ecd2ba1b141615f46ac52d0560033e551694
parent0ffa3b4cb8574c480b5d14008235c7f3a67e072b
rtc: check if __rtc_read_time was successful in rtc_timer_do_work()

[ Upstream commit e8ba8a2bc4f60a1065f23d6a0e7cbea945a0f40d ]

If the __rtc_read_time call fails,, the struct rtc_time tm; may contain
uninitialized data, or an illegal date/time read from the RTC hardware.

When calling rtc_tm_to_ktime later, the result may be a very large value
(possibly KTIME_MAX). If there are periodic timers in rtc->timerqueue,
they will continually expire, may causing kernel softlockup.

Fixes: 6610e0893b8b ("RTC: Rework RTC code to use timerqueue for events")
Signed-off-by: Yongliang Gao <leonylgao@tencent.com>
Acked-by: Jingqun Li <jingqunli@tencent.com>
Link: https://lore.kernel.org/r/20241011043153.3788112-1-leonylgao@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/rtc/interface.c