patch-2.4.0-test3 linux/arch/sparc64/kernel/sys_sparc32.c

Next file: linux/arch/sparc64/kernel/sys_sunos32.c
Previous file: linux/arch/sparc64/kernel/sys_sparc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test2/linux/arch/sparc64/kernel/sys_sparc32.c linux/arch/sparc64/kernel/sys_sparc32.c
@@ -1,4 +1,4 @@
-/* $Id: sys_sparc32.c,v 1.152 2000/06/22 17:44:47 davem Exp $
+/* $Id: sys_sparc32.c,v 1.154 2000/07/06 01:41:29 davem Exp $
  * sys_sparc32.c: Conversion between 32bit and 64bit native syscalls.
  *
  * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
@@ -279,7 +279,7 @@
 	char *tmp, *result;
 
 	result = ERR_PTR(-ENOMEM);
-	tmp = (char *)__get_free_page(GFP_KERNEL);
+	tmp = __getname();
 	if (tmp)  {
 		int retval = do_getname32(filename, tmp);
 
@@ -1184,8 +1184,6 @@
 	struct file *file;
 	long ret = -EBADF;
 
-	lock_kernel();
-
 	file = fget(fd);
 	if(!file)
 		goto bad_file;
@@ -1195,7 +1193,6 @@
 	fput(file);
 
 bad_file:
-	unlock_kernel();
 	return ret;
 }
 
@@ -1204,8 +1201,6 @@
 	struct file *file;
 	int ret = -EBADF;
 
-	lock_kernel();
-
 	file = fget(fd);
 	if(!file)
 		goto bad_file;
@@ -1214,7 +1209,6 @@
 	fput(file);
 
 bad_file:
-	unlock_kernel();
 	return ret;
 }
 
@@ -1266,14 +1260,12 @@
 	buf.count = 0;
 	buf.dirent = dirent;
 
-	lock_kernel();
 	error = vfs_readdir(file, fillonedir, &buf);
 	if (error < 0)
 		goto out_putf;
 	error = buf.count;
 
 out_putf:
-	unlock_kernel();
 	fput(file);
 out:
 	return error;
@@ -1333,7 +1325,6 @@
 	buf.count = count;
 	buf.error = 0;
 
-	lock_kernel();
 	error = vfs_readdir(file, filldir, &buf);
 	if (error < 0)
 		goto out_putf;
@@ -1344,7 +1335,6 @@
 		error = count - buf.count;
 	}
 out_putf:
-	unlock_kernel();
 	fput(file);
 out:
 	return error;
@@ -1587,7 +1577,6 @@
 	struct nameidata nd;
 	int error;
 
-	lock_kernel();
 	error = user_path_walk(filename, &nd);
 	if (!error) {
 		struct inode *inode = nd.dentry->d_inode;
@@ -1602,7 +1591,6 @@
 
 		path_release(&nd);
 	}
-	unlock_kernel();
 	return error;
 }
 
@@ -1611,7 +1599,6 @@
 	struct nameidata nd;
 	int error;
 
-	lock_kernel();
 	error = user_path_walk_link(filename, &nd);
 	if (!error) {
 		struct inode *inode = nd.dentry->d_inode;
@@ -1626,7 +1613,6 @@
 
 		path_release(&nd);
 	}
-	unlock_kernel();
 	return error;
 }
 
@@ -1635,15 +1621,13 @@
 	struct file *f;
 	int err = -EBADF;
 
-	lock_kernel();
 	f = fget(fd);
 	if (f) {
-		struct dentry *dentry = f->f_dentry;
-		struct inode *inode = dentry->d_inode;
+		struct inode *inode = f->f_dentry->d_inode;
 
 		if (inode->i_op &&
 		    inode->i_op->revalidate)
-			err = inode->i_op->revalidate(dentry);
+			err = inode->i_op->revalidate(f->f_dentry);
 		else
 			err = 0;
 		if (!err)
@@ -1651,7 +1635,6 @@
 
 		fput(f);
 	}
-	unlock_kernel();
 	return err;
 }
 
@@ -3029,9 +3012,7 @@
 	bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
 	memset(bprm.page, 0, MAX_ARG_PAGES * sizeof(bprm.page[0]));
 
-	lock_kernel();
 	file = open_exec(filename);
-	unlock_kernel();
 
 	retval = PTR_ERR(file);
 	if (IS_ERR(file))
@@ -3043,10 +3024,12 @@
 	bprm.loader = 0;
 	bprm.exec = 0;
 	if ((bprm.argc = count32(argv)) < 0) {
+		allow_write_access(file);
 		fput(file);
 		return bprm.argc;
 	}
 	if ((bprm.envc = count32(envp)) < 0) {
+		allow_write_access(file);
 		fput(file);
 		return bprm.envc;
 	}
@@ -3075,6 +3058,7 @@
 
 out:
 	/* Something went wrong, return the inode and free the argument pages*/
+	allow_write_access(bprm.file);
 	if (bprm.file)
 		fput(bprm.file);
 
@@ -4142,10 +4126,7 @@
 	if (!IS_ERR(tmp)) {
 		fd = get_unused_fd();
 		if (fd >= 0) {
-			struct file * f;
-			lock_kernel();
-			f = filp_open(tmp, flags, mode);
-			unlock_kernel();
+			struct file * f = filp_open(tmp, flags, mode);
 			error = PTR_ERR(f);
 			if (IS_ERR(f))
 				goto out_error;

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