linux-mips
[Top] [All Lists]

Re: [PATCH v2] unify sys_pipe implementation

To: DM <dm.n9107@gmail.com>
Subject: Re: [PATCH v2] unify sys_pipe implementation
From: "Michael Kerrisk" <mtk.manpages@gmail.com>
Date: Mon, 5 May 2008 11:15:53 +0200
Cc: "Ulrich Drepper" <drepper@redhat.com>, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, linux-mips@linux-mips.org, sparclinux@vger.kernel.org, torvalds@linux-foundation.org
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=yJHrhUWPm80nO9pg3l7+5CF9in2efx8o1cL5G3M2aIY=; b=TuVUwDepvr/y/ngeebB1kLyhvXWma1TBCDXyAnouPsHVXd8/alZw4h/eeOdfEVwfM1OXSKk9hqa1dQm3cV4Xh1HBFexb6DuptfByR/t1dNAR7VnjeqB0sOmDpz8OQTl6ih9LweabwEZUMC7Zux3YlWrhgxDuFZLdwnTObqzbXBQ=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=kMGZpkyX+ewQQ2eYahy7WrEm2zS69ON+UQRxAa7Y7S/2hmm7yz5qF15E7eJKJOyRVJi1Y5tZMRIlt6O/WLtPa48g3w1iL0Bj64i6WvydC9kOmR8R7O0MIZFne6HJvzYzr2eDx14ePQBYc6DypZiRRFHfhF+PG/7U9Lx4yZoqGQI=
In-reply-to: <5eeb9ad90805050130i39ae791dwe599c12fc08fb8ec@mail.gmail.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <200805031801.m43I109q032242@devserv.devel.redhat.com> <5eeb9ad90805050130i39ae791dwe599c12fc08fb8ec@mail.gmail.com>
Sender: linux-mips-bounce@linux-mips.org
On 5/5/08, DM <dm.n9107@gmail.com> wrote:
> On Sat, May 3, 2008 at 8:01 PM, Ulrich Drepper <drepper@redhat.com> 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?

Yes, it does -- I just tested this.

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html

<Prev in Thread] Current Thread [Next in Thread>