public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alessandro Zummo <alessandro.zummo@towertech.it>
To: Andrew Morton <akpm@osdl.org>
Cc: Andrew Victor <andrew@sanpeople.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] RTC: Ensure that time being passed to set_alarm() is valid.
Date: Wed, 7 Jun 2006 20:50:27 +0200	[thread overview]
Message-ID: <20060607205027.3016d386@inspiron> (raw)
In-Reply-To: <20060607113911.1dd03687.akpm@osdl.org>

On Wed, 7 Jun 2006 11:39:11 -0700
Andrew Morton <akpm@osdl.org> 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


  reply	other threads:[~2006-06-07 18:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-07 18:20 [PATCH] RTC: Ensure that time being passed to set_alarm() is valid Andrew Victor
2006-06-07 18:39 ` Andrew Morton
2006-06-07 18:50   ` Alessandro Zummo [this message]
2006-06-07 19:31 ` Russell King
2006-06-08  6:23   ` Andrew Victor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060607205027.3016d386@inspiron \
    --to=alessandro.zummo@towertech.it \
    --cc=akpm@osdl.org \
    --cc=andrew@sanpeople.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox