Module Name: src Committed By: maxv Date: Wed Apr 16 18:55:19 UTC 2014
Modified Files: src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vfsops.c src/sys/coda: coda_vfsops.c src/sys/fs/adosfs: advfsops.c src/sys/fs/cd9660: cd9660_vfsops.c src/sys/fs/efs: efs_vfsops.c src/sys/fs/filecorefs: filecore_vfsops.c src/sys/fs/hfs: hfs_vfsops.c src/sys/fs/msdosfs: msdosfs_vfsops.c src/sys/fs/nilfs: nilfs_vfsops.c src/sys/fs/ntfs: ntfs_vfsops.c src/sys/fs/ptyfs: ptyfs_vfsops.c src/sys/fs/puffs: puffs_vfsops.c src/sys/fs/smbfs: smbfs_vfsops.c src/sys/fs/sysvbfs: sysvbfs_vfsops.c src/sys/fs/tmpfs: tmpfs_vfsops.c src/sys/fs/udf: udf_vfsops.c src/sys/fs/union: union_vfsops.c src/sys/fs/unionfs: unionfs_vfsops.c src/sys/fs/v7fs: v7fs_vfsops.c src/sys/kern: vfs_syscalls.c src/sys/miscfs/nullfs: null_vfsops.c src/sys/miscfs/overlay: overlay_vfsops.c src/sys/miscfs/procfs: procfs_vfsops.c src/sys/miscfs/umapfs: umap_vfsops.c src/sys/nfs: nfs_vfsops.c src/sys/ufs/chfs: chfs_vfsops.c src/sys/ufs/ext2fs: ext2fs_vfsops.c src/sys/ufs/ffs: ffs_vfsops.c src/sys/ufs/lfs: lfs_vfsops.c src/sys/ufs/mfs: mfs_vfsops.c Log Message: An (un)privileged user can easily make the kernel dereference a NULL pointer. The kernel allows 'data' to be NULL; it's the fs's responsibility to ensure that it isn't NULL (if the fs actually needs data). ok christos@ To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 \ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c cvs rdiff -u -r1.80 -r1.81 src/sys/coda/coda_vfsops.c cvs rdiff -u -r1.69 -r1.70 src/sys/fs/adosfs/advfsops.c cvs rdiff -u -r1.83 -r1.84 src/sys/fs/cd9660/cd9660_vfsops.c cvs rdiff -u -r1.24 -r1.25 src/sys/fs/efs/efs_vfsops.c cvs rdiff -u -r1.75 -r1.76 src/sys/fs/filecorefs/filecore_vfsops.c cvs rdiff -u -r1.30 -r1.31 src/sys/fs/hfs/hfs_vfsops.c cvs rdiff -u -r1.106 -r1.107 src/sys/fs/msdosfs/msdosfs_vfsops.c cvs rdiff -u -r1.15 -r1.16 src/sys/fs/nilfs/nilfs_vfsops.c cvs rdiff -u -r1.93 -r1.94 src/sys/fs/ntfs/ntfs_vfsops.c cvs rdiff -u -r1.49 -r1.50 src/sys/fs/ptyfs/ptyfs_vfsops.c cvs rdiff -u -r1.109 -r1.110 src/sys/fs/puffs/puffs_vfsops.c cvs rdiff -u -r1.99 -r1.100 src/sys/fs/smbfs/smbfs_vfsops.c cvs rdiff -u -r1.42 -r1.43 src/sys/fs/sysvbfs/sysvbfs_vfsops.c cvs rdiff -u -r1.58 -r1.59 src/sys/fs/tmpfs/tmpfs_vfsops.c cvs rdiff -u -r1.66 -r1.67 src/sys/fs/udf/udf_vfsops.c cvs rdiff -u -r1.71 -r1.72 src/sys/fs/union/union_vfsops.c cvs rdiff -u -r1.12 -r1.13 src/sys/fs/unionfs/unionfs_vfsops.c cvs rdiff -u -r1.9 -r1.10 src/sys/fs/v7fs/v7fs_vfsops.c cvs rdiff -u -r1.478 -r1.479 src/sys/kern/vfs_syscalls.c cvs rdiff -u -r1.87 -r1.88 src/sys/miscfs/nullfs/null_vfsops.c cvs rdiff -u -r1.60 -r1.61 src/sys/miscfs/overlay/overlay_vfsops.c cvs rdiff -u -r1.90 -r1.91 src/sys/miscfs/procfs/procfs_vfsops.c cvs rdiff -u -r1.91 -r1.92 src/sys/miscfs/umapfs/umap_vfsops.c cvs rdiff -u -r1.226 -r1.227 src/sys/nfs/nfs_vfsops.c cvs rdiff -u -r1.10 -r1.11 src/sys/ufs/chfs/chfs_vfsops.c cvs rdiff -u -r1.179 -r1.180 src/sys/ufs/ext2fs/ext2fs_vfsops.c cvs rdiff -u -r1.296 -r1.297 src/sys/ufs/ffs/ffs_vfsops.c cvs rdiff -u -r1.320 -r1.321 src/sys/ufs/lfs/lfs_vfsops.c cvs rdiff -u -r1.106 -r1.107 src/sys/ufs/mfs/mfs_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c:1.11 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c:1.12 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c:1.11 Wed Apr 9 22:40:32 2014 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c Wed Apr 16 18:55:18 2014 @@ -1596,6 +1596,9 @@ zfs_mount(vfs_t *vfsp, const char *path, if (mvp->v_type != VDIR) return (ENOTDIR); + if (uap == NULL) + return (EINVAL); + mutex_enter(mvp->v_interlock); if ((uap->flags & MS_REMOUNT) == 0 && (uap->flags & MS_OVERLAY) == 0 && Index: src/sys/coda/coda_vfsops.c diff -u src/sys/coda/coda_vfsops.c:1.80 src/sys/coda/coda_vfsops.c:1.81 --- src/sys/coda/coda_vfsops.c:1.80 Sun Mar 23 15:21:15 2014 +++ src/sys/coda/coda_vfsops.c Wed Apr 16 18:55:17 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: coda_vfsops.c,v 1.80 2014/03/23 15:21:15 hannken Exp $ */ +/* $NetBSD: coda_vfsops.c,v 1.81 2014/04/16 18:55:17 maxv Exp $ */ /* * @@ -45,7 +45,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.80 2014/03/23 15:21:15 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.81 2014/04/16 18:55:17 maxv Exp $"); #ifndef _KERNEL_OPT #define NVCODA 4 @@ -178,6 +178,8 @@ coda_mount(struct mount *vfsp, /* Alloca CodaFid ctlfid = CTL_FID; int error; + if (data == NULL) + return EINVAL; if (vfsp->mnt_flag & MNT_GETARGS) return EINVAL; ENTRY; Index: src/sys/fs/adosfs/advfsops.c diff -u src/sys/fs/adosfs/advfsops.c:1.69 src/sys/fs/adosfs/advfsops.c:1.70 --- src/sys/fs/adosfs/advfsops.c:1.69 Sun Mar 23 15:21:15 2014 +++ src/sys/fs/adosfs/advfsops.c Wed Apr 16 18:55:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: advfsops.c,v 1.69 2014/03/23 15:21:15 hannken Exp $ */ +/* $NetBSD: advfsops.c,v 1.70 2014/04/16 18:55:18 maxv Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: advfsops.c,v 1.69 2014/03/23 15:21:15 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: advfsops.c,v 1.70 2014/04/16 18:55:18 maxv Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -92,6 +92,8 @@ adosfs_mount(struct mount *mp, const cha int error; mode_t accessmode; + if (args == NULL) + return EINVAL; if (*data_len < sizeof *args) return EINVAL; Index: src/sys/fs/cd9660/cd9660_vfsops.c diff -u src/sys/fs/cd9660/cd9660_vfsops.c:1.83 src/sys/fs/cd9660/cd9660_vfsops.c:1.84 --- src/sys/fs/cd9660/cd9660_vfsops.c:1.83 Mon Mar 24 04:03:25 2014 +++ src/sys/fs/cd9660/cd9660_vfsops.c Wed Apr 16 18:55:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660_vfsops.c,v 1.83 2014/03/24 04:03:25 dholland Exp $ */ +/* $NetBSD: cd9660_vfsops.c,v 1.84 2014/04/16 18:55:18 maxv Exp $ */ /*- * Copyright (c) 1994 @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.83 2014/03/24 04:03:25 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.84 2014/04/16 18:55:18 maxv Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -216,6 +216,8 @@ cd9660_mount(struct mount *mp, const cha int error; struct iso_mnt *imp = VFSTOISOFS(mp); + if (args == NULL) + return EINVAL; if (*data_len < sizeof *args) return EINVAL; Index: src/sys/fs/efs/efs_vfsops.c diff -u src/sys/fs/efs/efs_vfsops.c:1.24 src/sys/fs/efs/efs_vfsops.c:1.25 --- src/sys/fs/efs/efs_vfsops.c:1.24 Thu Dec 20 08:03:42 2012 +++ src/sys/fs/efs/efs_vfsops.c Wed Apr 16 18:55:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: efs_vfsops.c,v 1.24 2012/12/20 08:03:42 hannken Exp $ */ +/* $NetBSD: efs_vfsops.c,v 1.25 2014/04/16 18:55:18 maxv Exp $ */ /* * Copyright (c) 2006 Stephen M. Rumble <rum...@ephemeral.org> @@ -17,7 +17,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: efs_vfsops.c,v 1.24 2012/12/20 08:03:42 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: efs_vfsops.c,v 1.25 2014/04/16 18:55:18 maxv Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -180,6 +180,8 @@ efs_mount(struct mount *mp, const char * struct vnode *devvp; int err, mode; + if (args == NULL) + return EINVAL; if (*data_len < sizeof *args) return EINVAL; Index: src/sys/fs/filecorefs/filecore_vfsops.c diff -u src/sys/fs/filecorefs/filecore_vfsops.c:1.75 src/sys/fs/filecorefs/filecore_vfsops.c:1.76 --- src/sys/fs/filecorefs/filecore_vfsops.c:1.75 Sun Mar 23 15:21:15 2014 +++ src/sys/fs/filecorefs/filecore_vfsops.c Wed Apr 16 18:55:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: filecore_vfsops.c,v 1.75 2014/03/23 15:21:15 hannken Exp $ */ +/* $NetBSD: filecore_vfsops.c,v 1.76 2014/04/16 18:55:18 maxv Exp $ */ /*- * Copyright (c) 1994 The Regents of the University of California. @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: filecore_vfsops.c,v 1.75 2014/03/23 15:21:15 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: filecore_vfsops.c,v 1.76 2014/04/16 18:55:18 maxv Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -229,6 +229,8 @@ filecore_mount(struct mount *mp, const c int error; struct filecore_mnt *fcmp = NULL; + if (args == NULL) + return EINVAL; if (*data_len < sizeof *args) return EINVAL; Index: src/sys/fs/hfs/hfs_vfsops.c diff -u src/sys/fs/hfs/hfs_vfsops.c:1.30 src/sys/fs/hfs/hfs_vfsops.c:1.31 --- src/sys/fs/hfs/hfs_vfsops.c:1.30 Sun Mar 23 15:21:15 2014 +++ src/sys/fs/hfs/hfs_vfsops.c Wed Apr 16 18:55:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: hfs_vfsops.c,v 1.30 2014/03/23 15:21:15 hannken Exp $ */ +/* $NetBSD: hfs_vfsops.c,v 1.31 2014/04/16 18:55:18 maxv Exp $ */ /*- * Copyright (c) 2005, 2007 The NetBSD Foundation, Inc. @@ -99,7 +99,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: hfs_vfsops.c,v 1.30 2014/03/23 15:21:15 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hfs_vfsops.c,v 1.31 2014/04/16 18:55:18 maxv Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -201,6 +201,8 @@ hfs_mount(struct mount *mp, const char * int update; mode_t accessmode; + if (args == NULL) + return EINVAL; if (*data_len < sizeof *args) return EINVAL; Index: src/sys/fs/msdosfs/msdosfs_vfsops.c diff -u src/sys/fs/msdosfs/msdosfs_vfsops.c:1.106 src/sys/fs/msdosfs/msdosfs_vfsops.c:1.107 --- src/sys/fs/msdosfs/msdosfs_vfsops.c:1.106 Sun Mar 23 15:21:15 2014 +++ src/sys/fs/msdosfs/msdosfs_vfsops.c Wed Apr 16 18:55:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: msdosfs_vfsops.c,v 1.106 2014/03/23 15:21:15 hannken Exp $ */ +/* $NetBSD: msdosfs_vfsops.c,v 1.107 2014/04/16 18:55:18 maxv Exp $ */ /*- * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. @@ -48,7 +48,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.106 2014/03/23 15:21:15 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.107 2014/04/16 18:55:18 maxv Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -284,6 +284,8 @@ msdosfs_mount(struct mount *mp, const ch int error, flags; mode_t accessmode; + if (args == NULL) + return EINVAL; if (*data_len < sizeof *args) return EINVAL; Index: src/sys/fs/nilfs/nilfs_vfsops.c diff -u src/sys/fs/nilfs/nilfs_vfsops.c:1.15 src/sys/fs/nilfs/nilfs_vfsops.c:1.16 --- src/sys/fs/nilfs/nilfs_vfsops.c:1.15 Sun Mar 23 15:21:15 2014 +++ src/sys/fs/nilfs/nilfs_vfsops.c Wed Apr 16 18:55:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nilfs_vfsops.c,v 1.15 2014/03/23 15:21:15 hannken Exp $ */ +/* $NetBSD: nilfs_vfsops.c,v 1.16 2014/04/16 18:55:18 maxv Exp $ */ /* * Copyright (c) 2008, 2009 Reinoud Zandijk @@ -28,7 +28,7 @@ #include <sys/cdefs.h> #ifndef lint -__KERNEL_RCSID(0, "$NetBSD: nilfs_vfsops.c,v 1.15 2014/03/23 15:21:15 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nilfs_vfsops.c,v 1.16 2014/04/16 18:55:18 maxv Exp $"); #endif /* not lint */ @@ -800,6 +800,8 @@ nilfs_mount(struct mount *mp, const char DPRINTF(VFSCALL, ("nilfs_mount called\n")); + if (args == NULL) + return EINVAL; if (*data_len < sizeof *args) return EINVAL; Index: src/sys/fs/ntfs/ntfs_vfsops.c diff -u src/sys/fs/ntfs/ntfs_vfsops.c:1.93 src/sys/fs/ntfs/ntfs_vfsops.c:1.94 --- src/sys/fs/ntfs/ntfs_vfsops.c:1.93 Sun Mar 23 15:21:15 2014 +++ src/sys/fs/ntfs/ntfs_vfsops.c Wed Apr 16 18:55:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: ntfs_vfsops.c,v 1.93 2014/03/23 15:21:15 hannken Exp $ */ +/* $NetBSD: ntfs_vfsops.c,v 1.94 2014/04/16 18:55:18 maxv Exp $ */ /*- * Copyright (c) 1998, 1999 Semen Ustimenko @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.93 2014/03/23 15:21:15 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.94 2014/04/16 18:55:18 maxv Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -172,6 +172,8 @@ ntfs_mount ( struct vnode *devvp; struct ntfs_args *args = data; + if (args == NULL) + return EINVAL; if (*data_len < sizeof *args) return EINVAL; Index: src/sys/fs/ptyfs/ptyfs_vfsops.c diff -u src/sys/fs/ptyfs/ptyfs_vfsops.c:1.49 src/sys/fs/ptyfs/ptyfs_vfsops.c:1.50 --- src/sys/fs/ptyfs/ptyfs_vfsops.c:1.49 Fri Apr 4 18:10:29 2014 +++ src/sys/fs/ptyfs/ptyfs_vfsops.c Wed Apr 16 18:55:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: ptyfs_vfsops.c,v 1.49 2014/04/04 18:10:29 christos Exp $ */ +/* $NetBSD: ptyfs_vfsops.c,v 1.50 2014/04/16 18:55:18 maxv Exp $ */ /* * Copyright (c) 1992, 1993, 1995 @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ptyfs_vfsops.c,v 1.49 2014/04/04 18:10:29 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ptyfs_vfsops.c,v 1.50 2014/04/16 18:55:18 maxv Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -259,6 +259,8 @@ ptyfs_mount(struct mount *mp, const char struct ptyfsmount *pmnt; struct ptyfs_args *args = data; + if (args == NULL) + return EINVAL; if (*data_len != sizeof *args && *data_len != OSIZE) return EINVAL; Index: src/sys/fs/puffs/puffs_vfsops.c diff -u src/sys/fs/puffs/puffs_vfsops.c:1.109 src/sys/fs/puffs/puffs_vfsops.c:1.110 --- src/sys/fs/puffs/puffs_vfsops.c:1.109 Sun Mar 23 15:21:15 2014 +++ src/sys/fs/puffs/puffs_vfsops.c Wed Apr 16 18:55:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: puffs_vfsops.c,v 1.109 2014/03/23 15:21:15 hannken Exp $ */ +/* $NetBSD: puffs_vfsops.c,v 1.110 2014/04/16 18:55:18 maxv Exp $ */ /* * Copyright (c) 2005, 2006 Antti Kantee. All Rights Reserved. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: puffs_vfsops.c,v 1.109 2014/03/23 15:21:15 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: puffs_vfsops.c,v 1.110 2014/04/16 18:55:18 maxv Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -102,6 +102,8 @@ puffs_vfsop_mount(struct mount *mp, cons int error = 0, i; pid_t mntpid = curlwp->l_proc->p_pid; + if (data == NULL) + return EINVAL; if (*data_len < sizeof *args) return EINVAL; @@ -116,12 +118,6 @@ puffs_vfsop_mount(struct mount *mp, cons if (mp->mnt_flag & MNT_UPDATE) return EOPNOTSUPP; - /* - * We need the file system name - */ - if (!data) - return EINVAL; - args = (struct puffs_kargs *)data; if (args->pa_vers != PUFFSVERSION) { Index: src/sys/fs/smbfs/smbfs_vfsops.c diff -u src/sys/fs/smbfs/smbfs_vfsops.c:1.99 src/sys/fs/smbfs/smbfs_vfsops.c:1.100 --- src/sys/fs/smbfs/smbfs_vfsops.c:1.99 Sun Mar 23 15:21:15 2014 +++ src/sys/fs/smbfs/smbfs_vfsops.c Wed Apr 16 18:55:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: smbfs_vfsops.c,v 1.99 2014/03/23 15:21:15 hannken Exp $ */ +/* $NetBSD: smbfs_vfsops.c,v 1.100 2014/04/16 18:55:18 maxv Exp $ */ /* * Copyright (c) 2000-2001, Boris Popov @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: smbfs_vfsops.c,v 1.99 2014/03/23 15:21:15 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: smbfs_vfsops.c,v 1.100 2014/04/16 18:55:18 maxv Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -156,6 +156,8 @@ smbfs_mount(struct mount *mp, const char char *fromname; int error; + if (args == NULL) + return EINVAL; if (*data_len < sizeof *args) return EINVAL; Index: src/sys/fs/sysvbfs/sysvbfs_vfsops.c diff -u src/sys/fs/sysvbfs/sysvbfs_vfsops.c:1.42 src/sys/fs/sysvbfs/sysvbfs_vfsops.c:1.43 --- src/sys/fs/sysvbfs/sysvbfs_vfsops.c:1.42 Wed Dec 25 11:15:49 2013 +++ src/sys/fs/sysvbfs/sysvbfs_vfsops.c Wed Apr 16 18:55:19 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: sysvbfs_vfsops.c,v 1.42 2013/12/25 11:15:49 mlelstv Exp $ */ +/* $NetBSD: sysvbfs_vfsops.c,v 1.43 2014/04/16 18:55:19 maxv Exp $ */ /*- * Copyright (c) 2004 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vfsops.c,v 1.42 2013/12/25 11:15:49 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vfsops.c,v 1.43 2014/04/16 18:55:19 maxv Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -77,6 +77,8 @@ sysvbfs_mount(struct mount *mp, const ch DPRINTF("%s: mnt_flag=%x\n", __func__, mp->mnt_flag); + if (args == NULL) + return EINVAL; if (*data_len < sizeof *args) return EINVAL; Index: src/sys/fs/tmpfs/tmpfs_vfsops.c diff -u src/sys/fs/tmpfs/tmpfs_vfsops.c:1.58 src/sys/fs/tmpfs/tmpfs_vfsops.c:1.59 --- src/sys/fs/tmpfs/tmpfs_vfsops.c:1.58 Sun Mar 23 15:21:16 2014 +++ src/sys/fs/tmpfs/tmpfs_vfsops.c Wed Apr 16 18:55:19 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: tmpfs_vfsops.c,v 1.58 2014/03/23 15:21:16 hannken Exp $ */ +/* $NetBSD: tmpfs_vfsops.c,v 1.59 2014/04/16 18:55:19 maxv 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.58 2014/03/23 15:21:16 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tmpfs_vfsops.c,v 1.59 2014/04/16 18:55:19 maxv Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -103,6 +103,9 @@ tmpfs_mount(struct mount *mp, const char ino_t nodes; int error; + if (args == NULL) + return EINVAL; + /* Validate the version. */ if (*data_len < sizeof(*args) || args->ta_version != TMPFS_ARGS_VERSION) Index: src/sys/fs/udf/udf_vfsops.c diff -u src/sys/fs/udf/udf_vfsops.c:1.66 src/sys/fs/udf/udf_vfsops.c:1.67 --- src/sys/fs/udf/udf_vfsops.c:1.66 Sun Mar 23 15:21:16 2014 +++ src/sys/fs/udf/udf_vfsops.c Wed Apr 16 18:55:19 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: udf_vfsops.c,v 1.66 2014/03/23 15:21:16 hannken Exp $ */ +/* $NetBSD: udf_vfsops.c,v 1.67 2014/04/16 18:55:19 maxv Exp $ */ /* * Copyright (c) 2006, 2008 Reinoud Zandijk @@ -28,7 +28,7 @@ #include <sys/cdefs.h> #ifndef lint -__KERNEL_RCSID(0, "$NetBSD: udf_vfsops.c,v 1.66 2014/03/23 15:21:16 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: udf_vfsops.c,v 1.67 2014/04/16 18:55:19 maxv Exp $"); #endif /* not lint */ @@ -316,6 +316,8 @@ udf_mount(struct mount *mp, const char * DPRINTF(CALL, ("udf_mount called\n")); + if (args == NULL) + return EINVAL; if (*data_len < sizeof *args) return EINVAL; Index: src/sys/fs/union/union_vfsops.c diff -u src/sys/fs/union/union_vfsops.c:1.71 src/sys/fs/union/union_vfsops.c:1.72 --- src/sys/fs/union/union_vfsops.c:1.71 Sun Mar 23 15:21:16 2014 +++ src/sys/fs/union/union_vfsops.c Wed Apr 16 18:55:19 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: union_vfsops.c,v 1.71 2014/03/23 15:21:16 hannken Exp $ */ +/* $NetBSD: union_vfsops.c,v 1.72 2014/04/16 18:55:19 maxv Exp $ */ /* * Copyright (c) 1994 The Regents of the University of California. @@ -77,7 +77,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.71 2014/03/23 15:21:16 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.72 2014/04/16 18:55:19 maxv Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -119,6 +119,8 @@ union_mount(struct mount *mp, const char int len; size_t size; + if (args == NULL) + return EINVAL; if (*data_len < sizeof *args) return EINVAL; Index: src/sys/fs/unionfs/unionfs_vfsops.c diff -u src/sys/fs/unionfs/unionfs_vfsops.c:1.12 src/sys/fs/unionfs/unionfs_vfsops.c:1.13 --- src/sys/fs/unionfs/unionfs_vfsops.c:1.12 Sun Mar 23 15:21:16 2014 +++ src/sys/fs/unionfs/unionfs_vfsops.c Wed Apr 16 18:55:19 2014 @@ -89,6 +89,8 @@ unionfs_mount(struct mount *mp, const ch const char *cp; char *xp; + if (args == NULL) + return EINVAL; if (*data_len < sizeof *args) return EINVAL; Index: src/sys/fs/v7fs/v7fs_vfsops.c diff -u src/sys/fs/v7fs/v7fs_vfsops.c:1.9 src/sys/fs/v7fs/v7fs_vfsops.c:1.10 --- src/sys/fs/v7fs/v7fs_vfsops.c:1.9 Sat Nov 23 13:35:36 2013 +++ src/sys/fs/v7fs/v7fs_vfsops.c Wed Apr 16 18:55:19 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_vfsops.c,v 1.9 2013/11/23 13:35:36 christos Exp $ */ +/* $NetBSD: v7fs_vfsops.c,v 1.10 2014/04/16 18:55:19 maxv Exp $ */ /*- * Copyright (c) 2004, 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: v7fs_vfsops.c,v 1.9 2013/11/23 13:35:36 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: v7fs_vfsops.c,v 1.10 2014/04/16 18:55:19 maxv Exp $"); #if defined _KERNEL_OPT #include "opt_v7fs.h" #endif @@ -88,6 +88,8 @@ v7fs_mount(struct mount *mp, const char DPRINTF("mnt_flag=%x %s\n", mp->mnt_flag, update ? "update" : ""); + if (args == NULL) + return EINVAL; if (*data_len < sizeof(*args)) return EINVAL; Index: src/sys/kern/vfs_syscalls.c diff -u src/sys/kern/vfs_syscalls.c:1.478 src/sys/kern/vfs_syscalls.c:1.479 --- src/sys/kern/vfs_syscalls.c:1.478 Fri Apr 4 06:47:02 2014 +++ src/sys/kern/vfs_syscalls.c Wed Apr 16 18:55:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls.c,v 1.478 2014/04/04 06:47:02 maxv Exp $ */ +/* $NetBSD: vfs_syscalls.c,v 1.479 2014/04/16 18:55:18 maxv Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.478 2014/04/04 06:47:02 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.479 2014/04/16 18:55:18 maxv Exp $"); #ifdef _KERNEL_OPT #include "opt_fileassoc.h" @@ -481,6 +481,10 @@ do_sys_mount(struct lwp *l, struct vfsop } } + /* + * We allow data to be NULL, even for userspace. Some fs's don't need + * it. The others will handle NULL. + */ if (data != NULL && data_seg == UIO_USERSPACE) { if (data_len == 0) { /* No length supplied, use default for filesystem */ Index: src/sys/miscfs/nullfs/null_vfsops.c diff -u src/sys/miscfs/nullfs/null_vfsops.c:1.87 src/sys/miscfs/nullfs/null_vfsops.c:1.88 --- src/sys/miscfs/nullfs/null_vfsops.c:1.87 Sun Mar 23 15:21:16 2014 +++ src/sys/miscfs/nullfs/null_vfsops.c Wed Apr 16 18:55:19 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: null_vfsops.c,v 1.87 2014/03/23 15:21:16 hannken Exp $ */ +/* $NetBSD: null_vfsops.c,v 1.88 2014/04/16 18:55:19 maxv Exp $ */ /* * Copyright (c) 1999 National Aeronautics & Space Administration @@ -76,7 +76,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: null_vfsops.c,v 1.87 2014/03/23 15:21:16 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: null_vfsops.c,v 1.88 2014/04/16 18:55:19 maxv Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -107,6 +107,8 @@ nullfs_mount(struct mount *mp, const cha struct nameidata nd; int error; + if (args == NULL) + return EINVAL; if (*data_len < sizeof(*args)) return EINVAL; Index: src/sys/miscfs/overlay/overlay_vfsops.c diff -u src/sys/miscfs/overlay/overlay_vfsops.c:1.60 src/sys/miscfs/overlay/overlay_vfsops.c:1.61 --- src/sys/miscfs/overlay/overlay_vfsops.c:1.60 Sun Mar 23 15:21:16 2014 +++ src/sys/miscfs/overlay/overlay_vfsops.c Wed Apr 16 18:55:19 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: overlay_vfsops.c,v 1.60 2014/03/23 15:21:16 hannken Exp $ */ +/* $NetBSD: overlay_vfsops.c,v 1.61 2014/04/16 18:55:19 maxv Exp $ */ /* * Copyright (c) 1999, 2000 National Aeronautics & Space Administration @@ -74,7 +74,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: overlay_vfsops.c,v 1.60 2014/03/23 15:21:16 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: overlay_vfsops.c,v 1.61 2014/04/16 18:55:19 maxv Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -114,6 +114,8 @@ ov_mount(struct mount *mp, const char *p printf("ov_mount(mp = %p)\n", mp); #endif + if (args == NULL) + return EINVAL; if (*data_len < sizeof *args) return EINVAL; Index: src/sys/miscfs/procfs/procfs_vfsops.c diff -u src/sys/miscfs/procfs/procfs_vfsops.c:1.90 src/sys/miscfs/procfs/procfs_vfsops.c:1.91 --- src/sys/miscfs/procfs/procfs_vfsops.c:1.90 Sun Mar 23 15:21:16 2014 +++ src/sys/miscfs/procfs/procfs_vfsops.c Wed Apr 16 18:55:19 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: procfs_vfsops.c,v 1.90 2014/03/23 15:21:16 hannken Exp $ */ +/* $NetBSD: procfs_vfsops.c,v 1.91 2014/04/16 18:55:19 maxv Exp $ */ /* * Copyright (c) 1993 @@ -76,7 +76,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.90 2014/03/23 15:21:16 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.91 2014/04/16 18:55:19 maxv Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -130,6 +130,9 @@ procfs_mount( struct procfs_args *args = data; int error; + if (args == NULL) + return EINVAL; + if (UIO_MX & (UIO_MX-1)) { log(LOG_ERR, "procfs: invalid directory entry size"); return (EINVAL); Index: src/sys/miscfs/umapfs/umap_vfsops.c diff -u src/sys/miscfs/umapfs/umap_vfsops.c:1.91 src/sys/miscfs/umapfs/umap_vfsops.c:1.92 --- src/sys/miscfs/umapfs/umap_vfsops.c:1.91 Sun Mar 23 15:21:16 2014 +++ src/sys/miscfs/umapfs/umap_vfsops.c Wed Apr 16 18:55:19 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: umap_vfsops.c,v 1.91 2014/03/23 15:21:16 hannken Exp $ */ +/* $NetBSD: umap_vfsops.c,v 1.92 2014/04/16 18:55:19 maxv Exp $ */ /* * Copyright (c) 1992, 1993 @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: umap_vfsops.c,v 1.91 2014/03/23 15:21:16 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: umap_vfsops.c,v 1.92 2014/04/16 18:55:19 maxv Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -81,6 +81,8 @@ umapfs_mount(struct mount *mp, const cha int i; #endif + if (args == NULL) + return EINVAL; if (*data_len < sizeof *args) return EINVAL; Index: src/sys/nfs/nfs_vfsops.c diff -u src/sys/nfs/nfs_vfsops.c:1.226 src/sys/nfs/nfs_vfsops.c:1.227 --- src/sys/nfs/nfs_vfsops.c:1.226 Sun Mar 23 15:21:16 2014 +++ src/sys/nfs/nfs_vfsops.c Wed Apr 16 18:55:17 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_vfsops.c,v 1.226 2014/03/23 15:21:16 hannken Exp $ */ +/* $NetBSD: nfs_vfsops.c,v 1.227 2014/04/16 18:55:17 maxv Exp $ */ /* * Copyright (c) 1989, 1993, 1995 @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.226 2014/03/23 15:21:16 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.227 2014/04/16 18:55:17 maxv Exp $"); #if defined(_KERNEL_OPT) #include "opt_nfs.h" @@ -594,6 +594,8 @@ nfs_mount(struct mount *mp, const char * size_t len; u_char *nfh; + if (args == NULL) + return EINVAL; if (*data_len < sizeof *args) return EINVAL; Index: src/sys/ufs/chfs/chfs_vfsops.c diff -u src/sys/ufs/chfs/chfs_vfsops.c:1.10 src/sys/ufs/chfs/chfs_vfsops.c:1.11 --- src/sys/ufs/chfs/chfs_vfsops.c:1.10 Sun Mar 23 15:21:16 2014 +++ src/sys/ufs/chfs/chfs_vfsops.c Wed Apr 16 18:55:19 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: chfs_vfsops.c,v 1.10 2014/03/23 15:21:16 hannken Exp $ */ +/* $NetBSD: chfs_vfsops.c,v 1.11 2014/04/16 18:55:19 maxv Exp $ */ /*- * Copyright (c) 2010 Department of Software Engineering, @@ -123,6 +123,8 @@ chfs_mount(struct mount *mp, dbg("mount()\n"); + if (args == NULL) + return EINVAL; if (*data_len < sizeof *args) return EINVAL; Index: src/sys/ufs/ext2fs/ext2fs_vfsops.c diff -u src/sys/ufs/ext2fs/ext2fs_vfsops.c:1.179 src/sys/ufs/ext2fs/ext2fs_vfsops.c:1.180 --- src/sys/ufs/ext2fs/ext2fs_vfsops.c:1.179 Sun Mar 23 15:21:16 2014 +++ src/sys/ufs/ext2fs/ext2fs_vfsops.c Wed Apr 16 18:55:19 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_vfsops.c,v 1.179 2014/03/23 15:21:16 hannken Exp $ */ +/* $NetBSD: ext2fs_vfsops.c,v 1.180 2014/04/16 18:55:19 maxv Exp $ */ /* * Copyright (c) 1989, 1991, 1993, 1994 @@ -60,7 +60,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.179 2014/03/23 15:21:16 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.180 2014/04/16 18:55:19 maxv Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -305,6 +305,8 @@ ext2fs_mount(struct mount *mp, const cha int error = 0, flags, update; mode_t accessmode; + if (args == NULL) + return EINVAL; if (*data_len < sizeof *args) return EINVAL; Index: src/sys/ufs/ffs/ffs_vfsops.c diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.296 src/sys/ufs/ffs/ffs_vfsops.c:1.297 --- src/sys/ufs/ffs/ffs_vfsops.c:1.296 Tue Apr 1 14:28:17 2014 +++ src/sys/ufs/ffs/ffs_vfsops.c Wed Apr 16 18:55:19 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_vfsops.c,v 1.296 2014/04/01 14:28:17 christos Exp $ */ +/* $NetBSD: ffs_vfsops.c,v 1.297 2014/04/16 18:55:19 maxv Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.296 2014/04/01 14:28:17 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.297 2014/04/16 18:55:19 maxv Exp $"); #if defined(_KERNEL_OPT) #include "opt_ffs.h" @@ -345,6 +345,8 @@ ffs_mount(struct mount *mp, const char * int error = 0, flags, update; mode_t accessmode; + if (args == NULL) + return EINVAL; if (*data_len < sizeof *args) return EINVAL; Index: src/sys/ufs/lfs/lfs_vfsops.c diff -u src/sys/ufs/lfs/lfs_vfsops.c:1.320 src/sys/ufs/lfs/lfs_vfsops.c:1.321 --- src/sys/ufs/lfs/lfs_vfsops.c:1.320 Mon Mar 24 13:42:40 2014 +++ src/sys/ufs/lfs/lfs_vfsops.c Wed Apr 16 18:55:19 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_vfsops.c,v 1.320 2014/03/24 13:42:40 hannken Exp $ */ +/* $NetBSD: lfs_vfsops.c,v 1.321 2014/04/16 18:55:19 maxv Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007 @@ -61,7 +61,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.320 2014/03/24 13:42:40 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.321 2014/04/16 18:55:19 maxv Exp $"); #if defined(_KERNEL_OPT) #include "opt_lfs.h" @@ -628,6 +628,8 @@ lfs_mount(struct mount *mp, const char * int error = 0, update; mode_t accessmode; + if (args == NULL) + return EINVAL; if (*data_len < sizeof *args) return EINVAL; Index: src/sys/ufs/mfs/mfs_vfsops.c diff -u src/sys/ufs/mfs/mfs_vfsops.c:1.106 src/sys/ufs/mfs/mfs_vfsops.c:1.107 --- src/sys/ufs/mfs/mfs_vfsops.c:1.106 Sun Mar 23 15:21:17 2014 +++ src/sys/ufs/mfs/mfs_vfsops.c Wed Apr 16 18:55:19 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: mfs_vfsops.c,v 1.106 2014/03/23 15:21:17 hannken Exp $ */ +/* $NetBSD: mfs_vfsops.c,v 1.107 2014/04/16 18:55:19 maxv Exp $ */ /* * Copyright (c) 1989, 1990, 1993, 1994 @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mfs_vfsops.c,v 1.106 2014/03/23 15:21:17 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mfs_vfsops.c,v 1.107 2014/04/16 18:55:19 maxv Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -247,6 +247,8 @@ mfs_mount(struct mount *mp, const char * struct proc *p; int flags, error = 0; + if (args == NULL) + return EINVAL; if (*data_len < sizeof *args) return EINVAL;