Andrew Morton writes:
> --- linux-2.3.99-pre6-3/fs/namei.c Sun Apr 16 22:30:16 2000
> +++ linux-akpm/fs/namei.c Fri Apr 21 00:07:39 2000
> @@ -378,8 +378,11 @@
>
> err = -ENOENT;
> inode = dentry->d_inode;
> - if (!inode)
> + if (!inode) {
> + dput(nd->dentry);
> + nd->dentry = dentry;
> break;
> + }
> err = -ENOTDIR;
> if (!inode->i_op)
> break;
Al Viro published a more correct patch for this last week.
However, the problem is far larger than the above patch, or the original
patch from Al indicates - there appear to be a couple of areas where it
goes wrong.
Here is an overall better patch which hits the problem in 3 areas. The
first two hunks are as per Al's original patch. The third is one that
I received no feedback from Al on, but fixes another busy problem.
--- /mnt/src/kernel-sources/orig/v2.3/linux/fs/namei.c Wed Mar 1 11:39:14 2000
+++ fs/namei.c Sat Apr 15 15:23:18 2000
@@ -379,10 +379,10 @@
err = -ENOENT;
inode = dentry->d_inode;
if (!inode)
- break;
+ goto out_dput;
err = -ENOTDIR;
if (!inode->i_op)
- break;
+ goto out_dput;
if (inode->i_op->follow_link) {
err = do_follow_link(dentry, nd);
@@ -474,6 +474,9 @@
nd->last = this;
return_base:
return 0;
+out_dput:
+ dput(dentry);
+ break;
}
dput(nd->dentry);
mntput(nd->mnt);
@@ -834,7 +837,7 @@
dput(dir);
error = -EEXIST;
if (flag & O_EXCL)
- goto exit;
+ goto exit_dentry;
if (dentry->d_inode->i_op &&
dentry->d_inode->i_op->follow_link) {
/*
@@ -936,6 +939,8 @@
return 0;
+exit_dentry:
+ dput(dentry);
exit:
dput(nd->dentry);
mntput(nd->mnt);
_____
|_____| ------------------------------------------------- ---+---+-
| | Russell King rmk@arm.linux.org.uk --- ---
| | | | http://www.arm.linux.org.uk/~rmk/aboutme.html / / |
| +-+-+ --- -+-
/ | THE developer of ARM Linux |+| /|\
/ | | | --- |
+-+-+ ------------------------------------------------- /\\\ |
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sun Apr 23 2000 - 21:00:20 EST