Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Check for bogus flags to access() up front. Otherwi...



details:   https://anonhg.NetBSD.org/src/rev/702e5dd4a8d1
branches:  trunk
changeset: 762770:702e5dd4a8d1
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun Feb 27 23:06:40 2011 +0000

description:
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.

diffstat:

 sys/kern/vfs_syscalls.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r f77fee8c1993 -r 702e5dd4a8d1 sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c   Sun Feb 27 18:32:53 2011 +0000
+++ b/sys/kern/vfs_syscalls.c   Sun Feb 27 23:06:40 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls.c,v 1.414 2011/01/13 07:25:50 pooka Exp $ */
+/*     $NetBSD: vfs_syscalls.c,v 1.415 2011/02/27 23:06:40 dholland Exp $      */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.414 2011/01/13 07:25:50 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.415 2011/02/27 23:06:40 dholland Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -2484,6 +2484,11 @@
        struct pathbuf *pb;
        struct nameidata nd;
 
+       if ((SCARG(uap, flags) & ~(R_OK | W_OK | X_OK)) != 0) {
+               /* nonsense flags */
+               return EINVAL;
+       }
+
        error = pathbuf_copyin(SCARG(uap, path), &pb);
        if (error) {
                return error;



Home | Main Index | Thread Index | Old Index