mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Michael Kerrisk" <mtk.manpages@gmail.com>
To: DM <dm.n9107@gmail.com>
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
Subject: Re: [PATCH v2] unify sys_pipe implementation
Date: Mon, 5 May 2008 11:15:53 +0200	[thread overview]
Message-ID: <517f3f820805050215s689ae274yf8a4ad270cb5981c@mail.gmail.com> (raw)
In-Reply-To: <5eeb9ad90805050130i39ae791dwe599c12fc08fb8ec@mail.gmail.com>

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

  reply	other threads:[~2008-05-05  9:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-03 18:01 Ulrich Drepper
2008-05-03 18:40 ` Linus Torvalds
2008-05-05  8:30 ` DM
2008-05-05  9:15   ` Michael Kerrisk [this message]
2008-05-05 10:18   ` Ralf Baechle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=517f3f820805050215s689ae274yf8a4ad270cb5981c@mail.gmail.com \
    --to=mtk.manpages@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dm.n9107@gmail.com \
    --cc=drepper@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=sparclinux@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®