rtc: check if rtc_tm_to_ktime was successful in rtc_timer_do_work()
The struct rtc_time tm may contain a date/time read from the RTC hardware, but it is far away from now. However, __rtc_read_time return success. When calling rtc_tm_to_ktime later, the result may be a very large value KTIME_MAX. If there are periodic timers in rtc->timerqueue, they will continually expire, may causing kernel softlockup. Signed-off-by: Yongliang Gao <leonylgao@tencent.com> Reviewed-by: Jianping Liu <frankjpliu@tencent.com> Signed-off-by: Jianping Liu <frankjpliu@tencent.com>
This commit is contained in:
parent
083e3422ee
commit
6cf46c359c
|
@ -919,6 +919,11 @@ again:
|
|||
return;
|
||||
}
|
||||
now = rtc_tm_to_ktime(tm);
|
||||
if (now == KTIME_MAX) {
|
||||
dev_err(&rtc->dev, "Failed to convert rtc time\n");
|
||||
mutex_unlock(&rtc->ops_lock);
|
||||
return;
|
||||
}
|
||||
while ((next = timerqueue_getnext(&rtc->timerqueue))) {
|
||||
if (next->expires > now)
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue