From ceea6405b65a81a336b7c804dbe6c2dd0d84b72c Mon Sep 17 00:00:00 2001 From: Garrett Cooper Date: Thu, 8 Aug 2013 18:26:53 -0700 Subject: [PATCH] Handle invalid modes properly Sponsored-by: EMC Isilon --- sys/kern/vfs_syscalls.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index a004ea0..9350821 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -2094,6 +2094,9 @@ kern_accessat(struct thread *td, int fd, char *path, enum uio_seg pathseg, struct nameidata nd; int error; + if (amode & ~(F_OK | R_OK | W_OK | X_OK)) + return (EINVAL); + /* * Create and modify a temporary credential instead of one that * is potentially shared. -- 1.8.3.4