Module Name:    src
Committed By:   bouyer
Date:           Sun Mar 20 20:36:57 UTC 2011

Modified Files:
        src/sys/kern [netbsd-4]: vfs_syscalls.c

Log Message:
Pull up following revision(s) (requested by dholland in ticket #1417):
        sys/kern/vfs_syscalls.c: revision 1.415 via patch
Check for bogus flags to access() up front. Otherwise we end up
calling VOP_ACCESS with flags 0 and something asserts deep in the
bowels of kauth. PR 44648 from Taylor Campbell. (I moved the check
earlier relative to the suggested patch.)
Pullup candidate.


To generate a diff of this commit:
cvs rdiff -u -r1.279.2.5 -r1.279.2.6 src/sys/kern/vfs_syscalls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.279.2.5 src/sys/kern/vfs_syscalls.c:1.279.2.6
--- src/sys/kern/vfs_syscalls.c:1.279.2.5	Wed Feb 28 22:47:44 2007
+++ src/sys/kern/vfs_syscalls.c	Sun Mar 20 20:36:56 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.279.2.5 2007/02/28 22:47:44 pavel Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.279.2.6 2011/03/20 20:36:56 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.279.2.5 2007/02/28 22:47:44 pavel Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.279.2.6 2011/03/20 20:36:56 bouyer Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_compat_43.h"
@@ -2373,6 +2373,11 @@
 	int error, flags;
 	struct nameidata nd;
 
+	if ((SCARG(uap, flags) & ~(R_OK | W_OK | X_OK)) != 0) {
+		/* nonsense flags */
+		return EINVAL;
+	}
+
 	cred = kauth_cred_dup(l->l_cred);
 	kauth_cred_seteuid(cred, kauth_cred_getuid(l->l_cred));
 	kauth_cred_setegid(cred, kauth_cred_getgid(l->l_cred));

Reply via email to