Vaibhav Jain
d5cbc16656
rtc: interface: Validate alarm-time before handling rollover
...
[ Upstream commit da96aea0ed ]
In function __rtc_read_alarm() its possible for an alarm time-stamp to
be invalid even after replacing missing components with current
time-stamp. The condition 'alarm->time.tm_year < 70' will trigger this
case and will cause the call to 'rtc_tm_to_time64(&alarm->time)'
return a negative value for variable t_alm.
While handling alarm rollover this negative t_alm (assumed to seconds
offset from '1970-01-01 00:00:00') is converted back to rtc_time via
rtc_time64_to_tm() which results in this error log with seemingly
garbage values:
"rtc rtc0: invalid alarm value: -2-1--1041528741
2005511117:71582844:32"
This error was generated when the rtc driver (rtc-opal in this case)
returned an alarm time-stamp of '00-00-00 00:00:00' to indicate that
the alarm is disabled. Though I have submitted a separate fix for the
rtc-opal driver, this issue may potentially impact other
existing/future rtc drivers.
To fix this issue the patch validates the alarm time-stamp just after
filling up the missing datetime components and if rtc_valid_tm() still
reports it to be invalid then bails out of the function without
handling the rollover.
Reported-by: Steve Best <sbest@redhat.com >
Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com >
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com >
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-04-13 19:48:14 +02:00
..
2016-03-14 17:08:18 +01:00
2015-04-17 09:04:02 -04:00
2018-04-13 19:48:14 +02:00
2017-03-12 06:41:52 +01:00
2016-08-31 18:21:34 +02:00
2015-09-05 13:19:05 +02:00
2014-10-20 16:21:31 +02:00
2015-04-03 08:18:25 +02:00
2015-11-08 14:12:25 +01:00
2015-09-05 13:19:08 +02:00
2016-07-19 17:27:42 +02:00
2016-09-22 00:14:41 +02:00
2015-09-05 19:37:22 +02:00
2016-03-14 17:08:25 +01:00
2016-10-19 08:45:48 +02:00
2016-09-02 01:24:06 +02:00
2015-11-08 14:12:28 +01:00
2013-04-05 09:36:53 -07:00
2016-07-26 00:09:18 +02:00
2014-10-20 16:21:31 +02:00
2015-09-05 13:19:09 +02:00
2016-08-31 18:21:35 +02:00
2014-10-20 16:21:31 +02:00
2018-03-24 11:00:09 +01:00
2016-09-02 01:24:06 +02:00
2015-09-05 13:19:07 +02:00
2016-07-19 18:15:21 +02:00
2016-07-19 18:15:21 +02:00
2016-01-11 20:19:57 +01:00
2016-09-02 01:24:06 +02:00
2015-09-05 13:19:07 +02:00
2016-09-02 01:24:06 +02:00
2014-10-20 16:21:31 +02:00
2016-05-20 12:33:51 +02:00
2016-07-08 16:23:11 +02:00
2016-09-02 01:24:06 +02:00
2016-07-09 10:24:45 +02:00
2016-08-31 18:21:34 +02:00
2016-07-09 10:24:45 +02:00
2016-09-22 00:14:40 +02:00
2018-03-24 11:00:22 +01:00
2015-11-10 10:01:21 -08:00
2016-05-20 12:33:51 +02:00
2016-05-20 12:33:51 +02:00
2016-05-20 12:33:51 +02:00
2016-07-09 10:24:45 +02:00
2016-05-20 12:33:51 +02:00
2016-06-27 10:48:28 +02:00
2016-07-09 10:24:45 +02:00
2015-04-17 09:04:02 -04:00
2016-06-06 17:07:33 +02:00
2015-04-17 09:03:59 -04:00
2016-05-20 12:33:51 +02:00
2015-09-05 13:19:06 +02:00
2016-09-02 01:24:06 +02:00
2016-06-04 00:23:35 +02:00
2015-06-19 20:03:20 +02:00
2016-07-19 18:18:06 +02:00
2016-01-11 20:19:58 +01:00
2016-05-20 12:33:51 +02:00
2016-05-20 12:33:51 +02:00
2016-09-02 01:24:06 +02:00
2014-11-21 12:00:00 -08:00
2014-10-20 16:21:31 +02:00
2015-09-05 13:19:06 +02:00
2016-01-11 20:19:59 +01:00
2015-06-21 21:53:59 +02:00
2018-04-13 19:48:14 +02:00
2015-10-28 10:30:17 +09:00
2015-10-28 10:30:17 +09:00
2016-05-20 12:33:51 +02:00
2015-09-05 13:19:10 +02:00
2016-06-27 18:15:25 +02:00
2016-05-20 12:33:51 +02:00
2015-10-28 10:30:17 +09:00
2016-06-04 16:05:59 +02:00
2014-10-20 16:21:31 +02:00
2014-10-20 16:21:31 +02:00
2015-09-05 19:37:21 +02:00
2015-06-25 01:13:36 +02:00
2016-03-14 17:08:27 +01:00
2016-05-20 12:33:51 +02:00
2016-06-26 01:20:08 +02:00
2016-09-02 01:24:06 +02:00
2015-09-05 19:37:22 +02:00
2015-09-05 19:37:22 +02:00
2016-07-09 10:24:45 +02:00
2015-04-17 09:04:02 -04:00
2016-09-02 01:24:06 +02:00
2015-09-05 19:37:22 +02:00
2016-05-20 12:33:51 +02:00
2016-09-02 01:24:06 +02:00
2016-11-04 23:11:39 +01:00
2018-04-13 19:48:14 +02:00
2016-09-02 01:24:06 +02:00
2014-10-20 16:21:31 +02:00
2016-08-31 18:21:34 +02:00
2016-03-14 17:08:41 +01:00
2016-03-14 17:08:30 +01:00
2017-12-20 10:07:27 +01:00
2015-09-05 13:19:06 +02:00
2016-09-02 01:24:06 +02:00
2016-07-19 19:11:54 +02:00
2016-08-31 18:21:35 +02:00
2013-11-13 12:09:31 +09:00
2017-12-25 14:23:43 +01:00
2016-08-31 09:33:33 +01:00
2016-01-11 20:19:55 +01:00
2014-10-20 16:21:31 +02:00
2014-10-20 16:21:31 +02:00
2015-09-05 19:37:16 +02:00
2015-10-28 10:30:17 +09:00
2016-07-19 18:15:21 +02:00
2015-12-20 13:39:00 +01:00
2015-09-05 13:19:10 +02:00
2016-05-20 12:33:51 +02:00
2016-05-20 12:33:51 +02:00
2016-07-09 10:24:45 +02:00
2016-05-21 17:07:16 +02:00
2016-10-12 13:24:39 +02:00
2015-10-28 10:30:17 +09:00
2016-09-02 01:24:06 +02:00
2017-11-21 09:23:25 +01:00
2016-09-02 01:24:06 +02:00
2016-05-20 12:33:51 +02:00
2016-07-19 17:48:06 +02:00
2013-04-19 13:51:25 +02:00
2016-03-14 17:08:18 +01:00
2016-07-11 23:22:35 +02:00
2015-09-05 19:37:16 +02:00
2015-09-05 19:37:16 +02:00
2016-07-11 23:22:33 +02:00
2015-09-05 13:19:06 +02:00
2018-04-13 19:47:50 +02:00
2016-09-02 01:24:06 +02:00
2015-07-23 17:07:35 +01:00
2014-10-20 16:21:31 +02:00
2016-05-20 12:33:51 +02:00
2016-09-02 01:24:06 +02:00
2014-10-20 16:21:31 +02:00
2017-03-12 06:41:52 +01:00
2016-01-11 20:19:57 +01:00
2016-08-31 18:21:35 +02:00
2017-04-21 09:31:24 +02:00
2015-04-03 08:18:24 +02:00
2014-10-20 16:21:31 +02:00
2016-05-21 17:07:17 +02:00
2016-03-14 17:08:23 +01:00
2016-03-14 17:08:24 +01:00
2016-09-02 01:24:06 +02:00
2015-09-05 13:19:10 +02:00
2016-07-09 10:24:21 +02:00
2016-03-14 17:08:25 +01:00
2015-09-05 19:37:22 +02:00
2013-07-03 16:07:59 -07:00
2013-04-29 18:28:32 -07:00
2016-05-20 12:33:51 +02:00
2014-10-20 16:21:31 +02:00
2016-05-20 12:33:51 +02:00
2015-06-25 01:13:42 +02:00