On Wed, Nov 22, 2006 at 12:20:50PM +0100, Eric Dumazet ([email protected]) wrote:
> On Tuesday 21 November 2006 17:29, Evgeniy Polyakov wrote:
> > Pipe notifications.
>
> > +int kevent_pipe_enqueue(struct kevent *k)
> > +{
> > + struct file *pipe;
> > + int err = -EBADF;
> > + struct inode *inode;
> > +
> > + pipe = fget(k->event.id.raw[0]);
> > + if (!pipe)
> > + goto err_out_exit;
> > +
> > + inode = igrab(pipe->f_dentry->d_inode);
> > + if (!inode)
> > + goto err_out_fput;
> > +
>
> Well...
>
> How can you be sure 'pipe/inode' really refers to a pipe/fifo here ?
>
> Hint : i_pipe <> NULL is not sufficient because i_pipe, i_bdev, i_cdev share
> the same location. (check pipe_info() in fs/splice.c)
>
> So I guess you need :
>
> err = -EINVAL;
> if (!S_ISFIFO(inode->i_mode))
> goto err_out_iput;
You are correct, I did not perform that check, since all pipe open
functions do rely on the i_pipe, which can not be block device at that
point, but with kevent file descriptor can be anything, so that check
must be performed.
I will put it into the tree, thanks Eric.
> Eric
--
Evgeniy Polyakov
-
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]