Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Some fs's - like kernfs - set their vfs_min_mount_d...



details:   https://anonhg.NetBSD.org/src/rev/5950fbba5816
branches:  trunk
changeset: 328749:5950fbba5816
user:      maxv <maxv%NetBSD.org@localhost>
date:      Wed Apr 16 19:25:28 2014 +0000

description:
Some fs's - like kernfs - set their vfs_min_mount_data to zero. Add a check
to prevent an (un)privileged user from requesting a zero-sized allocation
(and thus a panic).

diffstat:

 sys/kern/vfs_syscalls.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 8853181ff8b2 -r 5950fbba5816 sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c   Wed Apr 16 18:55:17 2014 +0000
+++ b/sys/kern/vfs_syscalls.c   Wed Apr 16 19:25:28 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls.c,v 1.479 2014/04/16 18:55:18 maxv Exp $  */
+/*     $NetBSD: vfs_syscalls.c,v 1.480 2014/04/16 19:25:28 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.479 2014/04/16 18:55:18 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.480 2014/04/16 19:25:28 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -498,7 +498,7 @@
                            && data_len < sizeof (struct mnt_export_args30))
                                data_len = sizeof (struct mnt_export_args30);
                }
-               if (data_len > VFS_MAX_MOUNT_DATA) {
+               if ((data_len == 0) || (data_len > VFS_MAX_MOUNT_DATA)) {
                        error = EINVAL;
                        goto done;
                }



Home | Main Index | Thread Index | Old Index