patch-2.3.41 linux/kernel/sysctl.c

Next file: linux/lib/vsprintf.c
Previous file: linux/kernel/sys.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.40/linux/kernel/sysctl.c linux/kernel/sysctl.c
@@ -43,7 +43,7 @@
 extern int max_threads;
 extern int nr_queued_signals, max_queued_signals;
 
-/* this is needed for the proc_dointvec_minmax for overflow UID and GID */
+/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
 static int maxolduid = 65535;
 static int minolduid = 0;
 
@@ -722,9 +722,16 @@
 		  void *buffer, size_t *lenp)
 {
 	int r;
-	down(&uts_sem);
-	r=proc_dostring(table,write,filp,buffer,lenp);
-	up(&uts_sem);
+
+	if (!write) {
+		down_read(&uts_sem);
+		r=proc_dostring(table,0,filp,buffer,lenp);
+		up_read(&uts_sem);
+	} else {
+		down_write(&uts_sem);
+		r=proc_dostring(table,1,filp,buffer,lenp);
+		up_write(&uts_sem);
+	}
 	return r;
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)