patch-2.1.65 linux/fs/namei.c

Next file: linux/fs/nfsd/export.c
Previous file: linux/fs/lockd/svcsubs.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.64/linux/fs/namei.c linux/fs/namei.c
@@ -235,9 +235,11 @@
 		result = ERR_PTR(-ENOMEM);
 		if (dentry) {
 			int error = dir->i_op->lookup(dir, dentry);
-			result = ERR_PTR(error);
-			if (!error)
-				result = dentry;
+			result = dentry;
+			if (error) {
+				dput(dentry);
+				result = ERR_PTR(error);
+			}
 		}
 	}
 	up(&dir->i_sem);

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