RTC: Ensure that time being passed to set_alarm() is valid.
PATCH 1/1 RTC: Ensure that time being passed to set_alarm() is valid.
RTC: Ensure that the time being passed to set_alarm() is valid.
diff -urN -x CVS linux-2.6.17-rc6/drivers/rtc/interface.c linux-2.6.17-rc/drivers/rtc/interface.c
drivers/rtc/interface.c +4 -0
@@ -129,6 +129,10 @@int err;struct rtc_device *rtc =to_rtc_device (class_dev); + err =rtc_valid_tm (&alarm->time); +if (err !=0 ) +return err; + err =mutex_lock_interruptible (&rtc->ops_lock);if (err)return -EBUSY ;
Quoted 13 lines · On 07 Jun 2006 20:20:55 +0200 Andrew Victor <[email protected]> wrote:
RTC: Ensure that the time being passed to
set_alarm()is valid.Signed-off-by Andrew Victor <[email protected]>Signed-off-by Alessandro Zummo <[email protected]>diff -urN -x CVS
linux-2.6.17-rc6/drivers/rtc/interface.clinux-2.6.17-rc/drivers/rtc/interface.c
drivers/rtc/interface.c line 138
Quoted 10 lines
drivers/rtc/interface.c +4
-0@@ -129,6 +129,10 @@int err;struct rtc_device *rtc =to_rtc_device (class_dev); + err =rtc_valid_tm (&alarm->time); +if (err !=0 ) +return err; + err =mutex_lock_interruptible (&rtc->ops_lock);if (err)return -EBUSY ;
More details, please. How can this situation come about? Buggy kernel code? Userspace action?
Quoted 8 lines · On Wed, 7 Jun 2006 11:39:11 -0700 Andrew Morton <[email protected]> wrote:
Quoted 8 lines
diff -urN -x CVS
linux-2.6.17-rc6/drivers/rtc/interface.clinux-2.6.17-rc/drivers/rtc/interface.cdrivers/rtc/interface.c +0
-0@@ -129,6 +129,10 @@int err;struct rtc_device *rtc =to_rtc_device (class_dev);
Quoted 11 lines
drivers/rtc/interface.c line 138
Quoted 8 lines
drivers/rtc/interface.c +4
-0+ err =rtc_valid_tm (&alarm->time); +if (err !=0 ) +return err; + err =mutex_lock_interruptible (&rtc->ops_lock);if (err)return -EBUSY ;More details, please. How can this situation come about? Buggy kernel code? Userspace action?
both of them. this call is used by the dev interface but might also be used by any in-kernel user (there are none at the moment, but we might have them in the future).
the same kind of check is done in rtc_set_time()
for the same reason.
however, the dev interface (RTC_ALM_SET)
sets some of the tm fields to -1, which is
invalid for rtc_valid_tm.
I haven't thought of this when I suggested to Andrew Victor to add this rtc_valid_tm call.
so we might have to remove this call or to modify rtc_valid_tm to detect this.
suggestions?
Signature · 6 lines
Best regards, Alessandro Zummo, Tower Technologies - Turin, Italy http://www.towertech.it
Quoted 1 line · Andrew Victor
RTC: Ensure that the time being passed to
set_alarm()is valid.
NAK. rtc_valid_tm checks that the time/date is valid (eg, month is within range). Alarms can have a "don't care" state for each part - for example, setting month to 0xff means "alarm every month".
See the API exposed by /dev/rtc on x86 by virtue of being the MC146818 register set.
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of: 2.6 Serial core
hi,
Quoted 5 lines
Quoted 1 line
RTC: Ensure that the time being passed to
set_alarm()is valid.NAK.
rtc_valid_tmchecks that the time/date is valid (eg, month is within range). Alarms can have a "don't care" state for each part - for example, setting month to0xffmeans "alarm every month".
OK. Drop this patch.
Regards,
Andrew Victor