[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1393372009.2886.5.camel@linux-whg8.site>
Date: Tue, 25 Feb 2014 15:46:49 -0800
From: Nathaniel Yazdani <n1ght.4nd.d4y@...il.com>
To: Eric Wong <normalperson@...t.net>
Cc: viro@...iv.linux.org.uk, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH for-next 4/4] epoll: epoll() syscall definition
On Tue, 2014-02-25 at 10:21 +0000, Eric Wong wrote:
> Nathaniel Yazdani <n1ght.4nd.d4y@...il.com> wrote:
> > + * stores triggered eventpoll entries in the 'out' array. The input array is
> > + * _not_ read-only, because the resulting event mask gets written back to each
> > + * entry's ->ep_events field. When successful, this will be the same as before
> > + * (plus EPOLLERR & EPOLLHUP). If ->ep_events gets cleared, then it is reasonable
> > + * to infer that the entry's ->ep_fildes was a bad file descriptor.
> > + */
>
> > + if (!access_ok(VERIFY_WRITE, in, inc * sizeof(struct epoll)))
> > + goto out;
> > + for (i = 0; i < inc; ++i) {
> > + int fd, io;
> > + long long id;
> > +
> > + ret = -EFAULT;
> > + if (__get_user(fd, &in[i].ep_fildes) ||
> > + __get_user(io, &in[i].ep_events) ||
> > + __get_user(id, &in[i].ep_ident))
> > + goto out;
> > +
> > + ep_control(file->private_data, fd, &io, id, 0);
> > + ret = -EFAULT;
> > + if (__put_user(io, &in[i].ep_events))
> > + goto out;
>
> I don't think we should waste cycles writing to 'in' on success.
Fair enough, my thought process was mainly too add some consistency to
the system call, but removing that constraint would clean up
ep_control() anyway.
--
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