]> git.hungrycats.org Git - linux/commit
drivers/rtc/interface.c: fix infinite loop in initializing the alarm
authorAles Novak <alnovak@suse.cz>
Fri, 6 Jun 2014 21:35:39 +0000 (14:35 -0700)
committerJiri Slaby <jslaby@suse.cz>
Tue, 26 Aug 2014 12:12:25 +0000 (14:12 +0200)
commit9db8cb5a6fa96ef0637e55f66dd970e51224d99c
treeddb2adece6e4d755c6d096b9259886571c8c19ec
parent33751b9ed01ee46fd1c20cf8c42c396704d88b28
drivers/rtc/interface.c: fix infinite loop in initializing the alarm

commit ee1d90146815fdc8d653c558b327fff2acba041d upstream.

In __rtc_read_alarm(), if the alarm time retrieved by
rtc_read_alarm_internal() from the device contains invalid values (e.g.
month=2,mday=31) and the year not set (=-1), the initialization will
loop infinitely because the year-fixing loop expects the time being
invalid due to leap year.

Fix reduces the loop to the leap years and adds final validity check.

Signed-off-by: Ales Novak <alnovak@suse.cz>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Reported-by: Jiri Bohac <jbohac@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/rtc/interface.c