Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/tmpfs Check for invalid mount arguments early and gra...



details:   https://anonhg.NetBSD.org/src/rev/e9f2ae6745c2
branches:  trunk
changeset: 329806:e9f2ae6745c2
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Jun 10 16:10:59 2014 +0000

description:
Check for invalid mount arguments early and gracefully fail the mount.
Spotted by pooka@

diffstat:

 sys/fs/tmpfs/tmpfs_vfsops.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (33 lines):

diff -r ce047c1c8893 -r e9f2ae6745c2 sys/fs/tmpfs/tmpfs_vfsops.c
--- a/sys/fs/tmpfs/tmpfs_vfsops.c       Tue Jun 10 15:44:27 2014 +0000
+++ b/sys/fs/tmpfs/tmpfs_vfsops.c       Tue Jun 10 16:10:59 2014 +0000
@@ -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 @@
        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;



Home | Main Index | Thread Index | Old Index