linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: David Brownell <david-b@pacbell.net>
Cc: rtc-linux@googlegroups.com,
	kernel list <linux-kernel@vger.kernel.org>,
	Alessandro Zummo <alessandro.zummo@towertech.it>
Subject: Re: RTC wakealarm write-only, still has 644 permissions
Date: Thu, 29 Nov 2007 00:26:51 +0100	[thread overview]
Message-ID: <20071128232651.GD4947@elf.ucw.cz> (raw)
In-Reply-To: <20071128230451.GA1547@elf.ucw.cz>

Hi!

> rtc-sysfs.c: why this?
> 
>         if (alarm > now) {
>                 /* Avoid accidentally clobbering active alarms; we
> can't
>                  * entirely prevent that here, without even the
> minimal
>                  * locking from the /dev/rtcN api.
>                  */
>                 retval = rtc_read_alarm(rtc, &alm);
>                 if (retval < 0)
>                         return retval;
>                 if (alm.enabled)
>                         return -EBUSY;
> 
>                 alm.enabled = 1;
> 
> People should not be "accidentally" writing to sysfs files...

If I remove "accidental alarm modify" logic, I can actually use rtc to
wake up more than once per boot.

Signed-off-by: Pavel Machek <pavel@suse.cz>

diff --git a/drivers/rtc/rtc-sysfs.c b/drivers/rtc/rtc-sysfs.c
index 2ae0e83..ba5e806 100644
--- a/drivers/rtc/rtc-sysfs.c
+++ b/drivers/rtc/rtc-sysfs.c
@@ -149,16 +149,6 @@ rtc_sysfs_set_wakealarm(struct device *d
 
 	alarm = simple_strtoul(buf, NULL, 0);
 	if (alarm > now) {
-		/* Avoid accidentally clobbering active alarms; we can't
-		 * entirely prevent that here, without even the minimal
-		 * locking from the /dev/rtcN api.
-		 */
-		retval = rtc_read_alarm(rtc, &alm);
-		if (retval < 0)
-			return retval;
-		if (alm.enabled)
-			return -EBUSY;
-
 		alm.enabled = 1;
 	} else {
 		alm.enabled = 0;


-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

      parent reply	other threads:[~2007-11-28 23:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-20 10:32 RTC wakealarm write-only, still has 644 permissions Pavel Machek
2007-09-20 10:50 ` Pavel Machek
2007-09-22  5:38   ` David Brownell
2007-10-02  9:36     ` Pavel Machek
2007-10-03  2:15       ` David Brownell
2007-11-28 23:26     ` Pavel Machek
2007-11-29  8:02       ` Tino Keitel
2007-11-29 18:10       ` David Brownell
2007-11-29 18:14         ` Alessandro Zummo
2007-11-30 20:35         ` Pavel Machek
2007-11-30 21:10           ` David Brownell
2007-11-30 21:20             ` Mark Lord
2007-11-30 21:27               ` Pavel Machek
2007-12-02 11:36             ` Pavel Machek
2007-12-02 16:03               ` David Brownell
     [not found]     ` <20071128230451.GA1547@elf.ucw.cz>
2007-11-28 23:26       ` Pavel Machek [this message]

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=20071128232651.GD4947@elf.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=alessandro.zummo@towertech.it \
    --cc=david-b@pacbell.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    /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;
as well as URLs for NNTP newsgroup(s).