Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Add sanity check to sysctl_kern_maxvnodes.
details: https://anonhg.NetBSD.org/src/rev/31b0dacd222b
branches: trunk
changeset: 781829:31b0dacd222b
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Wed Oct 03 07:22:59 2012 +0000
description:
Add sanity check to sysctl_kern_maxvnodes.
diffstat:
sys/kern/init_sysctl.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diffs (32 lines):
diff -r 586090b9364f -r 31b0dacd222b sys/kern/init_sysctl.c
--- a/sys/kern/init_sysctl.c Wed Oct 03 07:20:50 2012 +0000
+++ b/sys/kern/init_sysctl.c Wed Oct 03 07:22:59 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: init_sysctl.c,v 1.190 2012/06/02 21:36:46 dsl Exp $ */
+/* $NetBSD: init_sysctl.c,v 1.191 2012/10/03 07:22:59 mlelstv Exp $ */
/*-
* Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.190 2012/06/02 21:36:46 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.191 2012/10/03 07:22:59 mlelstv Exp $");
#include "opt_sysv.h"
#include "opt_compat_netbsd.h"
@@ -968,6 +968,13 @@
if (error || newp == NULL)
return (error);
+ /*
+ * sysctl passes down unsigned values, require them
+ * to be positive
+ */
+ if (new_vnodes <= 0)
+ return (EINVAL);
+
/* Limits: 75% of KVA and physical memory. */
new_max = calc_cache_size(kernel_map, 75, 75) / VNODE_COST;
if (new_vnodes > new_max)
Home |
Main Index |
Thread Index |
Old Index