Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754932AbZAMWud (ORCPT ); Tue, 13 Jan 2009 17:50:33 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755368AbZAMWuM (ORCPT ); Tue, 13 Jan 2009 17:50:12 -0500 Received: from mx1.redhat.com ([66.187.233.31]:60066 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757753AbZAMWuJ (ORCPT ); Tue, 13 Jan 2009 17:50:09 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit From: Roland McGrath To: Linus Torvalds , Andrew Morton X-Fcc: ~/Mail/linus Cc: mtk.manpages@gmail.com, "kernel list" , "Ulrich Drepper" , "Vegard Nossum" , "linux-man@vger.kernel.org" Subject: [PATCH] sys_waitid: return -EFAULT for NULL In-Reply-To: Roland McGrath's message of Tuesday, 13 January 2009 14:47:59 -0800 <20090113224759.7DFB7FC3DD@magilla.sf.frob.com> X-Fcc: ~/Mail/linus References: <20090113224759.7DFB7FC3DD@magilla.sf.frob.com> X-Shopping-List: (1) Scenic pyrotechnical sandwiches (2) Trenchant detergent socks (3) Pregnant unit checks Message-Id: <20090113224941.36F19FC3DD@magilla.sf.frob.com> Date: Tue, 13 Jan 2009 14:49:41 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 917 Lines: 26 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 --- 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))) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/