mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 03:10:12 +00:00
[PATCH] namei fixes (12/19)
In open_namei() we take mntput(nd->mnt);nd->mnt=path.mnt; out of the if (__follow_mount(...)), making it conditional on nd->mnt != path.mnt instead. Then we shift the result downstream. Equivalent transformations. Signed-off-by: Al Viro <viro@parcelfarce.linux.theplanet.co.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
2f12dbfbb6
commit
a15a3f6fc6
1 changed files with 9 additions and 2 deletions
11
fs/namei.c
11
fs/namei.c
|
@ -1506,8 +1506,6 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
|
||||||
mntput(path.mnt);
|
mntput(path.mnt);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
mntput(nd->mnt);
|
|
||||||
nd->mnt = path.mnt;
|
|
||||||
}
|
}
|
||||||
error = -ENOENT;
|
error = -ENOENT;
|
||||||
if (!path.dentry->d_inode)
|
if (!path.dentry->d_inode)
|
||||||
|
@ -1517,6 +1515,9 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
|
||||||
|
|
||||||
dput(nd->dentry);
|
dput(nd->dentry);
|
||||||
nd->dentry = path.dentry;
|
nd->dentry = path.dentry;
|
||||||
|
if (nd->mnt != path.mnt)
|
||||||
|
mntput(nd->mnt);
|
||||||
|
nd->mnt = path.mnt;
|
||||||
error = -EISDIR;
|
error = -EISDIR;
|
||||||
if (path.dentry->d_inode && S_ISDIR(path.dentry->d_inode->i_mode))
|
if (path.dentry->d_inode && S_ISDIR(path.dentry->d_inode->i_mode))
|
||||||
goto exit;
|
goto exit;
|
||||||
|
@ -1528,6 +1529,9 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
|
||||||
|
|
||||||
exit_dput:
|
exit_dput:
|
||||||
dput(path.dentry);
|
dput(path.dentry);
|
||||||
|
if (nd->mnt != path.mnt)
|
||||||
|
mntput(nd->mnt);
|
||||||
|
nd->mnt = path.mnt;
|
||||||
exit:
|
exit:
|
||||||
path_release(nd);
|
path_release(nd);
|
||||||
return error;
|
return error;
|
||||||
|
@ -1550,6 +1554,9 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
|
||||||
error = security_inode_follow_link(path.dentry, nd);
|
error = security_inode_follow_link(path.dentry, nd);
|
||||||
if (error)
|
if (error)
|
||||||
goto exit_dput;
|
goto exit_dput;
|
||||||
|
if (nd->mnt != path.mnt)
|
||||||
|
mntput(nd->mnt);
|
||||||
|
nd->mnt = path.mnt;
|
||||||
error = __do_follow_link(&path, nd);
|
error = __do_follow_link(&path, nd);
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
Loading…
Reference in a new issue