[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201103041055.27199.arnd@arndb.de>
Date: Fri, 4 Mar 2011 10:55:27 +0100
From: Arnd Bergmann <arnd@...db.de>
To: Richard Cochran <richardcochran@...il.com>
Cc: Torben Hohn <torbenh@....de>, linux-kernel@...r.kernel.org,
richard.cochran@...cron.at, johnstul@...ibm.com, tglx@...utronix.de
Subject: Re: [PATCH 3/3] Check for write permission on FD based posix-clocks
On Friday 04 March 2011 08:22:39 Richard Cochran wrote:
> > diff --git a/kernel/time/posix-clock.c b/kernel/time/posix-clock.c
> > index 04498cb..25028dd 100644
> > --- a/kernel/time/posix-clock.c
> > +++ b/kernel/time/posix-clock.c
> > @@ -287,11 +287,16 @@ static int pc_clock_adjtime(clockid_t id, struct timex *tx)
> > if (err)
> > return err;
> >
> > + if ((cd.fp->f_mode & FMODE_WRITE) == 0) {
> > + err = -EACCES;
>
> Looks like clock_settime and adjtimex are supposed to return EPERM in
> this case.
>
I think both choices are correct:
EACCESS often refers to the file permissions of an inode or the mode
of an open file. EPERM usually means that an operation can only be
performed by the owner of an object or by root. So clock_settime and
adjtimex should return EPERM and pc_clock_adjtime should return EACCESS.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists