Re: [PATCH] RTC: Ensure that time being passed to set_alarm() is valid.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 7 Jun 2006 11:39:11 -0700
Andrew Morton <[email protected]> wrote:

> > diff -urN -x CVS linux-2.6.17-rc6/drivers/rtc/interface.c
> > linux-2.6.17-rc/drivers/rtc/interface.c
> > --- linux-2.6.17-rc6/drivers/rtc/interface.c	Tue Jun  6 10:28:05 2006
> > +++ linux-2.6.17-rc/drivers/rtc/interface.c	Wed Jun  7 11:46:28 2006
> > @@ -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?

 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?

-- 

 Best regards,

 Alessandro Zummo,
  Tower Technologies - Turin, Italy

  http://www.towertech.it

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux