diff options
| -rw-r--r-- | sys/fs/tmpfs/tmpfs_vfsops.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index ba412b55787..6cfdff501c1 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: tmpfs_vfsops.c,v 1.62 2014/06/07 09:54:34 martin Exp $ */ +/* $NetBSD: tmpfs_vfsops.c,v 1.63 2014/06/10 16:10:59 martin Exp $ */ /* * Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tmpfs_vfsops.c,v 1.62 2014/06/07 09:54:34 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tmpfs_vfsops.c,v 1.63 2014/06/10 16:10:59 martin Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -135,6 +135,14 @@ tmpfs_mount(struct mount *mp, const char *path, void *data, size_t *data_len) if (tmpfs_mem_info(true) < uvmexp.freetarg) return EINVAL; + /* Check for invalid uid and gid arguments */ + if (args->ta_root_uid == VNOVAL || args->ta_root_gid == VNOVAL) + return EINVAL; + + /* This can never happen? */ + if ((args->ta_root_mode & ALLPERMS) == VNOVAL) + return EINVAL; + /* Get the memory usage limit for this file-system. */ if (args->ta_size_max < PAGE_SIZE) { memlimit = UINT64_MAX; |
