All of lore.kernel.org
 help / color / mirror / Atom feed
* (no subject)
@ 2011-12-30 23:53 P.
  2011-12-31  0:35 ` [PATCH resend] rtc: Fix alarm rollover when day or month is out-of-range Jonathan Nieder
  0 siblings, 1 reply; 3+ messages in thread
From: P. @ 2011-12-30 23:53 UTC (permalink / raw)
  To: rtc-linux; +Cc: linux-kernel, Alessandro Zummo, John Stultz, 653331

Hi everyone,

Following the advice from Jonathan Nieder I am sending this mail. There is a bug that can cause an infinite loop (stopping the system from booting) when the wakealarm field contains invalid data. In my case, I have four wildcards instead of a numerical year. I have posted the full boot log for kernel 3.2-rc7 in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=653331 .

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=646429 is now the primary report for this bug.

Best regards,

P. van Gaans

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH resend] rtc: Fix alarm rollover when day or month is out-of-range
  2011-12-30 23:53 P.
@ 2011-12-31  0:35 ` Jonathan Nieder
  2012-01-02 13:41   ` Alessandro Zummo
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Nieder @ 2011-12-31  0:35 UTC (permalink / raw)
  To: P.; +Cc: rtc-linux, linux-kernel, Alessandro Zummo, John Stultz,
	Ben Hutchings

From: Ben Hutchings <ben@decadent.org.uk>
Date: Thu, 29 Dec 2011 16:41:56 +0100

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@googlemail.com>
Reported-by: "P. van Gaans" <mailme667@yahoo.co.uk>
Cc: stable@vger.kernel.org
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
P. wrote:

> Following the advice from Jonathan Nieder I am sending this mail.

Old advice. :)

Here's a patch that was sent to the rtc-linux list, but I can't
seem to find it with search.gmane.org.

 drivers/rtc/interface.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 3bcc7cfcaba7..67b68c4543d0 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -232,11 +232,11 @@ int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
 		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;
-- 
1.7.8.2+next.20111228


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH resend] rtc: Fix alarm rollover when day or month is out-of-range
  2011-12-31  0:35 ` [PATCH resend] rtc: Fix alarm rollover when day or month is out-of-range Jonathan Nieder
@ 2012-01-02 13:41   ` Alessandro Zummo
  0 siblings, 0 replies; 3+ messages in thread
From: Alessandro Zummo @ 2012-01-02 13:41 UTC (permalink / raw)
  To: Jonathan Nieder
  Cc: P., rtc-linux, linux-kernel, John Stultz, Ben Hutchings, akpm

On Fri, 30 Dec 2011 18:35:52 -0600
Jonathan Nieder <jrnieder@gmail.com> wrote:

> From: Ben Hutchings <ben@decadent.org.uk>
> Date: Thu, 29 Dec 2011 16:41:56 +0100
> 
> 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@googlemail.com>
> Reported-by: "P. van Gaans" <mailme667@yahoo.co.uk>
> Cc: stable@vger.kernel.org
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>


 Seems reasonable, ty.


 Acked-by: Alessandro Zummo <a.zummo@towertech.it>

-- 

 Best regards,

 Alessandro Zummo,
  Tower Technologies - Torino, Italy

  http://www.towertech.it


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-02 13:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-30 23:53 P.
2011-12-31  0:35 ` [PATCH resend] rtc: Fix alarm rollover when day or month is out-of-range Jonathan Nieder
2012-01-02 13:41   ` Alessandro Zummo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.