[PATCH] namei fixes (5/19)

fix for too early mntput() in open_namei() - we pin path.mnt down for the
duration of __do_follow_link().  Otherwise we could get the fs where our
symlink lived unmounted while we were in __do_follow_link().  That would end
up with dentry of symlink staying pinned down through the fs shutdown.

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:
Al Viro 2005-06-06 13:36:01 -07:00 committed by Linus Torvalds
parent d73ffe16b8
commit 1be4a0900b
1 changed files with 2 additions and 0 deletions

View File

@ -1524,8 +1524,10 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
error = security_inode_follow_link(path.dentry, nd);
if (error)
goto exit_dput;
mntget(path.mnt);
error = __do_follow_link(path.dentry, nd);
dput(path.dentry);
mntput(path.mnt);
path.mnt = nd->mnt;
if (error)
return error;