patch-2.1.106 linux/arch/arm/kernel/sys_arm.c

Next file: linux/arch/i386/boot/setup.S
Previous file: linux/arch/alpha/mm/init.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.105/linux/arch/arm/kernel/sys_arm.c linux/arch/arm/kernel/sys_arm.c
@@ -309,16 +309,20 @@
 asmlinkage int sys_uname (struct old_utsname * name)
 {
 	static int warned = 0;
-
+	int err;
+	
 	if (warned == 0) {
 		warned ++;
 		printk (KERN_NOTICE "%s (%d): obsolete uname call\n",
 			current->comm, current->pid);
 	}
 
-	if (name && !copy_to_user (name, &system_utsname, sizeof (*name)))
-		return 0;
-	return -EFAULT;
+	if(!name)
+		return -EFAULT;
+	down(&uts_sem);
+	err=copy_to_user (name, &system_utsname, sizeof (*name));
+	up(&uts_sem);
+	return err?-EFAULT:0;
 }
 
 asmlinkage int sys_olduname(struct oldold_utsname * name)
@@ -338,6 +342,8 @@
 	if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname)))
 		return -EFAULT;
 
+	down(&uts_sem);
+	
 	error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN);
 	error -= __put_user(0,name->sysname+__OLD_UTS_LEN);
 	error -= __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN);
@@ -348,6 +354,9 @@
 	error -= __put_user(0,name->version+__OLD_UTS_LEN);
 	error -= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN);
 	error -= __put_user(0,name->machine+__OLD_UTS_LEN);
+	
+	up(&uts_sem);
+	
 	error = error ? -EFAULT : 0;
 
 	return error;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov