patch-2.1.127 linux/arch/sparc/kernel/sys_sunos.c

Next file: linux/arch/sparc/lib/bitops.S
Previous file: linux/arch/sparc/kernel/sys_sparc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.126/linux/arch/sparc/kernel/sys_sunos.c linux/arch/sparc/kernel/sys_sunos.c
@@ -1,4 +1,4 @@
-/* $Id: sys_sunos.c,v 1.92 1998/08/31 03:40:53 davem Exp $
+/* $Id: sys_sunos.c,v 1.94 1998/10/12 06:15:04 jj Exp $
  * sys_sunos.c: SunOS specific syscall compatibility support.
  *
  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
@@ -68,6 +68,7 @@
 	struct file * file = NULL;
 	unsigned long retval, ret_type;
 
+	down(&current->mm->mmap_sem);
 	lock_kernel();
 	current->personality |= PER_BSD;
 	if(flags & MAP_NORESERVE) {
@@ -128,6 +129,7 @@
 		fput(file);
 out:
 	unlock_kernel();
+	up(&current->mm->mmap_sem);
 	return retval;
 }
 
@@ -147,6 +149,7 @@
 	unsigned long rlim;
 	unsigned long newbrk, oldbrk;
 
+	down(&current->mm->mmap_sem);
 	lock_kernel();
 	if(ARCH_SUN4C_SUN4) {
 		if(brk >= 0x20000000 && brk < 0xe0000000) {
@@ -213,6 +216,7 @@
 	retval = 0;
 out:
 	unlock_kernel();
+	up(&current->mm->mmap_sem);
 	return retval;
 }
 
@@ -579,20 +583,16 @@
 
 asmlinkage int sunos_uname(struct sunos_utsname *name)
 {
-	int ret = -EFAULT;
-
+	int ret;
 	down(&uts_sem);
-	if(!name)
-		goto out;
-	if(copy_to_user(&name->sname[0], &system_utsname.sysname[0], sizeof(name->sname) - 1))
-		goto out;
-	copy_to_user(&name->nname[0], &system_utsname.nodename[0], sizeof(name->nname) - 1);
-	put_user('\0', &name->nname[8]);
-	copy_to_user(&name->rel[0], &system_utsname.release[0], sizeof(name->rel) - 1);
-	copy_to_user(&name->ver[0], &system_utsname.version[0], sizeof(name->ver) - 1);
-	copy_to_user(&name->mach[0], &system_utsname.machine[0], sizeof(name->mach) - 1);
-	ret = 0;
-out:
+	ret = copy_to_user(&name->sname[0], &system_utsname.sysname[0], sizeof(name->sname) - 1);
+	if (!ret) {
+		ret |= __copy_to_user(&name->nname[0], &system_utsname.nodename[0], sizeof(name->nname) - 1);
+		ret |= __put_user('\0', &name->nname[8]);
+		ret |= __copy_to_user(&name->rel[0], &system_utsname.release[0], sizeof(name->rel) - 1);
+		ret |= __copy_to_user(&name->ver[0], &system_utsname.version[0], sizeof(name->ver) - 1);
+		ret |= __copy_to_user(&name->mach[0], &system_utsname.machine[0], sizeof(name->mach) - 1);
+	}
 	up(&uts_sem);
 	return ret;
 }
@@ -843,7 +843,7 @@
 	strncpy (linux_nfs_mount.hostname, the_name, 254);
 	linux_nfs_mount.hostname [255] = 0;
 	putname (the_name);
-
+	
 	dev = get_unnamed_dev ();
 	
 	ret = do_mount (dev, "", dir_name, "nfs", linux_flags, &linux_nfs_mount);
@@ -860,6 +860,9 @@
 	int ret = -EINVAL;
 	char *dev_fname = 0;
 
+	if (!capable (CAP_SYS_ADMIN))
+		return -EPERM;
+		
 	lock_kernel();
 	/* We don't handle the integer fs type */
 	if ((flags & SMNT_NEWTYPE) == 0)

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