The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Roland McGrath <roland@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: mtk.manpages@gmail.com,
	"kernel list" <linux-kernel@vger.kernel.org>,
	"Ulrich Drepper" <drepper@redhat.com>,
	"Vegard Nossum" <vegard.nossum@gmail.com>,
	"linux-man@vger.kernel.org" <linux-man@vger.kernel.org>
Subject: [PATCH] sys_waitid: return -EFAULT for NULL
Date: Tue, 13 Jan 2009 14:49:41 -0800 (PST)	[thread overview]
Message-ID: <20090113224941.36F19FC3DD@magilla.sf.frob.com> (raw)
In-Reply-To: Roland McGrath's message of  Tuesday, 13 January 2009 14:47:59 -0800 <20090113224759.7DFB7FC3DD@magilla.sf.frob.com>

It's always been invalid to call waitid() with a NULL pointer.  It was an
oversight that it was allowed (and acts like a wait4() call instead).

Signed-off-by: Roland McGrath <roland@redhat.com>
---
 kernel/exit.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/kernel/exit.c b/kernel/exit.c
index c7740fa..fa25790 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1760,6 +1760,8 @@ asmlinkage long sys_waitid(int which, pid_t upid,
 	enum pid_type type;
 	long ret;
 
+	if (unlikely(!infop))
+		return -EFAULT;
 	if (options & ~(WNOHANG|WNOWAIT|WEXITED|WSTOPPED|WCONTINUED))
 		return -EINVAL;
 	if (!(options & (WEXITED|WSTOPPED|WCONTINUED)))

  reply	other threads:[~2009-01-13 22:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cfd18e0f0901131436ud2cf61bkf0e6b00f4b765bb5@mail.gmail.com>
2009-01-13 22:38 ` waitid() return value strangeness when infop is NULL Michael Kerrisk
2009-01-13 22:43   ` Michael Kerrisk
2009-01-13 22:47   ` Roland McGrath
2009-01-13 22:49     ` Roland McGrath [this message]
2009-01-13 23:14       ` [PATCH] sys_waitid: return -EFAULT for NULL Michael Kerrisk
2009-01-13 23:24         ` Andrew Morton
2009-01-13 23:36           ` Michael Kerrisk
2009-01-13 23:47           ` Roland McGrath
2009-01-14  0:13             ` Michael Kerrisk
2009-01-14  0:24               ` Ulrich Drepper
2009-01-14  0:33       ` Linus Torvalds
2009-01-14  0:53         ` Michael Kerrisk
2009-01-14  0:57           ` Linus Torvalds
2009-01-14  1:39             ` Michael Kerrisk
2009-01-14  2:10               ` Linus Torvalds
2009-01-14  2:28                 ` Michael Kerrisk

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=20090113224941.36F19FC3DD@magilla.sf.frob.com \
    --to=roland@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=drepper@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=torvalds@linux-foundation.org \
    --cc=vegard.nossum@gmail.com \
    /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