Commit 2f12dbfb authored by Al Viro's avatar Al Viro Committed by Linus Torvalds

[PATCH] namei fixes (11/19)

shifted conditional mntput() calls in __link_path_walk() downstream.

Obviously equivalent transformation.
Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.theplanet.co.uk>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent e13b210f
...@@ -791,8 +791,6 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd) ...@@ -791,8 +791,6 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd)
break; break;
/* Check mountpoints.. */ /* Check mountpoints.. */
__follow_mount(&next); __follow_mount(&next);
if (nd->mnt != next.mnt)
mntput(nd->mnt);
err = -ENOENT; err = -ENOENT;
inode = next.dentry->d_inode; inode = next.dentry->d_inode;
...@@ -803,6 +801,8 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd) ...@@ -803,6 +801,8 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd)
goto out_dput; goto out_dput;
if (inode->i_op->follow_link) { if (inode->i_op->follow_link) {
if (nd->mnt != next.mnt)
mntput(nd->mnt);
err = do_follow_link(&next, nd); err = do_follow_link(&next, nd);
if (err) if (err)
goto return_err; goto return_err;
...@@ -815,6 +815,8 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd) ...@@ -815,6 +815,8 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd)
break; break;
} else { } else {
dput(nd->dentry); dput(nd->dentry);
if (nd->mnt != next.mnt)
mntput(nd->mnt);
nd->mnt = next.mnt; nd->mnt = next.mnt;
nd->dentry = next.dentry; nd->dentry = next.dentry;
} }
...@@ -851,17 +853,19 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd) ...@@ -851,17 +853,19 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd)
if (err) if (err)
break; break;
__follow_mount(&next); __follow_mount(&next);
if (nd->mnt != next.mnt)
mntput(nd->mnt);
inode = next.dentry->d_inode; inode = next.dentry->d_inode;
if ((lookup_flags & LOOKUP_FOLLOW) if ((lookup_flags & LOOKUP_FOLLOW)
&& inode && inode->i_op && inode->i_op->follow_link) { && inode && inode->i_op && inode->i_op->follow_link) {
if (next.mnt != nd->mnt)
mntput(nd->mnt);
err = do_follow_link(&next, nd); err = do_follow_link(&next, nd);
if (err) if (err)
goto return_err; goto return_err;
inode = nd->dentry->d_inode; inode = nd->dentry->d_inode;
} else { } else {
dput(nd->dentry); dput(nd->dentry);
if (nd->mnt != next.mnt)
mntput(nd->mnt);
nd->mnt = next.mnt; nd->mnt = next.mnt;
nd->dentry = next.dentry; nd->dentry = next.dentry;
} }
...@@ -901,6 +905,8 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd) ...@@ -901,6 +905,8 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd)
return 0; return 0;
out_dput: out_dput:
dput(next.dentry); dput(next.dentry);
if (nd->mnt != next.mnt)
mntput(nd->mnt);
break; break;
} }
path_release(nd); path_release(nd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment