[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20080505101809.GA14547@linux-mips.org>
Date: Mon, 5 May 2008 11:18:09 +0100
From: Ralf Baechle <ralf@...ux-mips.org>
To: DM <dm.n9107@...il.com>
Cc: Ulrich Drepper <drepper@...hat.com>, linux-kernel@...r.kernel.org,
akpm@...ux-foundation.org, linux-mips@...ux-mips.org,
sparclinux@...r.kernel.org, torvalds@...ux-foundation.org
Subject: Re: [PATCH v2] unify sys_pipe implementation
On Mon, May 05, 2008 at 10:30:09AM +0200, DM wrote:
> > + * sys_pipe() is the normal C calling standard for creating
> > + * a pipe. It's not the way Unix traditionally does this, though.
> > + */
> > +asmlinkage long sys_pipe(int __user *fildes)
> > +{
> > + int fd[2];
> > + int error;
> > +
> > + error = do_pipe(fd);
> > + if (!error) {
> > + if (copy_to_user(fildes, fd, sizeof(fd)))
> > + error = -EFAULT;
> > + }
> > + return error;
> > +}
> > +
> [...]
>
> I realize this code is old, but wouldn't file descriptors leak if
> copy_to_user fails?
The MIPS implementation doesn't have this problem; it returns the
file descriptors in the result registers $v0 and $v1.
But an interesting catch after so many years!
Ralf
--
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