[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20120124023924.386300194@clark.kroah.org>
Date: Mon, 23 Jan 2012 18:33:45 -0800
From: Greg KH <gregkh@...e.de>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: torvalds@...ux-foundation.org, akpm@...ux-foundation.org,
alan@...rguk.ukuu.org.uk, Ben Hutchings <ben@...adent.org.uk>,
Jonathan Nieder <jrnieder@...il.com>,
Mark Brown <broonie@...nsource.wolfsonmicro.com>,
Marcelo Roberto Jimenez <mroberto@...i.cetuc.puc-rio.br>,
Thomas Gleixner <tglx@...utronix.de>,
John Stultz <john.stultz@...aro.org>,
Alessandro Zummo <a.zummo@...ertech.it>
Subject: [005/129] drivers/rtc/interface.c: fix alarm rollover when day or month is out-of-range
3.2-stable review patch. If anyone has any objections, please let me know.
------------------
Content-Length: 1761
Lines: 46
From: Ben Hutchings <ben@...adent.org.uk>
commit e74a8f2edb92cb690b467cea0ab652c509e9f624 upstream.
Commit f44f7f96a20a ("RTC: Initialize kernel state from RTC") introduced a
potential infinite loop. If an alarm time contains a wildcard month and
an invalid day (> 31), or a wildcard year and an invalid month (>= 12),
the loop searching for the next matching date will never terminate. Treat
the invalid values as wildcards.
Fixes <http://bugs.debian.org/646429>, <http://bugs.debian.org/653331>
Reported-by: leo weppelman <leoweppelman@...glemail.com>
Reported-by: "P. van Gaans" <mailme667@...oo.co.uk>
Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
Signed-off-by: Jonathan Nieder <jrnieder@...il.com>
Cc: Mark Brown <broonie@...nsource.wolfsonmicro.com>
Cc: Marcelo Roberto Jimenez <mroberto@...i.cetuc.puc-rio.br>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: John Stultz <john.stultz@...aro.org>
Acked-by: Alessandro Zummo <a.zummo@...ertech.it>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...e.de>
---
drivers/rtc/interface.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -228,11 +228,11 @@ int __rtc_read_alarm(struct rtc_device *
alarm->time.tm_hour = now.tm_hour;
/* For simplicity, only support date rollover for now */
- if (alarm->time.tm_mday == -1) {
+ if (alarm->time.tm_mday < 1 || alarm->time.tm_mday > 31) {
alarm->time.tm_mday = now.tm_mday;
missing = day;
}
- if (alarm->time.tm_mon == -1) {
+ if ((unsigned)alarm->time.tm_mon >= 12) {
alarm->time.tm_mon = now.tm_mon;
if (missing == none)
missing = month;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists