patch-1.3.29 linux/fs/proc/root.c

Next file: linux/include/asm-alpha/page.h
Previous file: linux/fs/proc/mem.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.28/linux/fs/proc/root.c linux/fs/proc/root.c
@@ -328,8 +328,10 @@
 	}
 
 	de = (struct proc_dir_entry *) dir->u.generic_ip;
-	if (!de)
+	if (!de) {
+		iput(dir);
 		return -EINVAL;
+	}
 
 	/* Special case "." and "..": they aren't on the directory list */
 	*result = dir;
@@ -354,8 +356,10 @@
 		if (proc_match(len, name, de))
 			break;
 	}
-	if (!de)
+	if (!de) {
+		iput(dir);
 		return -ENOENT;
+	}
 
 	ino = de->low_ino | (dir->i_ino & ~(0xffff));
 
@@ -371,11 +375,14 @@
 	struct inode ** result)
 {
 	unsigned int pid, c;
-	int i, ino;
+	int i, ino, retval;
 
-	int retval = proc_lookup(dir, name, len, result);
-	if (retval != -ENOENT)
+	dir->i_count++;
+	retval = proc_lookup(dir, name, len, result);
+	if (retval != -ENOENT) {
+		iput(dir);
 		return retval;
+	}
 	
 	pid = 0;
 	while (len-- > 0) {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this