Subject: kern/4313: sysctl -w kern.maxvnodes is mishandled
To: None <gnats-bugs@gnats.netbsd.org>
From: Bill Sommerfeld <sommerfeld@orchard.east-arlington.ma.us>
List: netbsd-bugs
Date: 10/21/1997 17:07:24
>Number:         4313
>Category:       kern
>Synopsis:       sysctl -w kern.maxvnodes is mishandled
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 21 10:20:06 1997
>Last-Modified:
>Originator:     Bill Sommerfeld
>Organization:
	none
>Release:        971021
>Environment:
	
System: NetBSD orchard.east-arlington.ma.us 1.2G NetBSD 1.2G (ORCHARD) #4: Sat Aug 2 19:58:42 EDT 1997 sommerfeld@orchard.east-arlington.ma.us:/home/src/ipsec-sys/sys/arch/i386/compile/ORCHARD i386


>Description:
	sysctl -w kern.maxvnodes doesn't actually change anything.

>How-To-Repeat:
	sysctl -w kern.maxvnodes=200
	sysctl kern.maxvnodes
>Fix:

RCS file: /cvsroot/src/sys/kern/kern_sysctl.c,v
retrieving revision 1.28
diff -u -r1.28 kern_sysctl.c
--- kern_sysctl.c	1997/09/19 13:56:39	1.28
+++ kern_sysctl.c	1997/10/20 19:14:10
@@ -221,9 +221,11 @@
 		return (sysctl_rdstring(oldp, oldlenp, newp, version));
 	case KERN_MAXVNODES:
 		old_vnodes = desiredvnodes;
-		error = sysctl_int(oldp, oldlenp, newp, newlen, &old_vnodes);
-		if (old_vnodes > desiredvnodes)
+		error = sysctl_int(oldp, oldlenp, newp, newlen, &desiredvnodes);
+		if (old_vnodes > desiredvnodes) {
+		        desiredvnodes = old_vnodes;
 			return (EINVAL);
+		}
 		return (error);
 	case KERN_MAXPROC:
 		return (sysctl_int(oldp, oldlenp, newp, newlen, &maxproc));

>Audit-Trail:
>Unformatted: