Commit d73ffe16 authored by Al Viro's avatar Al Viro Committed by Linus Torvalds

[PATCH] namei fixes (4/19)

path.mnt in open_namei() set to mirror nd->mnt.

nd->mnt is set in 3 places in that function - path_lookup() in the beginning,
__follow_down() loop after do_last: and __do_follow_link() call after
do_link:.

We set path.mnt to nd->mnt after path_lookup() and __do_follow_link().  In
__follow_down() loop we use &path.mnt instead of &nd->mnt and set nd->mnt to
path.mnt immediately after that loop.

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 4e7506e4
...@@ -1442,6 +1442,7 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd) ...@@ -1442,6 +1442,7 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
nd->flags &= ~LOOKUP_PARENT; nd->flags &= ~LOOKUP_PARENT;
down(&dir->d_inode->i_sem); down(&dir->d_inode->i_sem);
path.dentry = __lookup_hash(&nd->last, nd->dentry, nd); path.dentry = __lookup_hash(&nd->last, nd->dentry, nd);
path.mnt = nd->mnt;
do_last: do_last:
error = PTR_ERR(path.dentry); error = PTR_ERR(path.dentry);
...@@ -1479,7 +1480,8 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd) ...@@ -1479,7 +1480,8 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
error = -ELOOP; error = -ELOOP;
if (flag & O_NOFOLLOW) if (flag & O_NOFOLLOW)
goto exit_dput; goto exit_dput;
while (__follow_down(&nd->mnt,&path.dentry) && d_mountpoint(path.dentry)); while (__follow_down(&path.mnt,&path.dentry) && d_mountpoint(path.dentry));
nd->mnt = path.mnt;
} }
error = -ENOENT; error = -ENOENT;
if (!path.dentry->d_inode) if (!path.dentry->d_inode)
...@@ -1524,6 +1526,7 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd) ...@@ -1524,6 +1526,7 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
goto exit_dput; goto exit_dput;
error = __do_follow_link(path.dentry, nd); error = __do_follow_link(path.dentry, nd);
dput(path.dentry); dput(path.dentry);
path.mnt = nd->mnt;
if (error) if (error)
return error; return error;
nd->flags &= ~LOOKUP_PARENT; nd->flags &= ~LOOKUP_PARENT;
......
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