Skip to contentSkip to conversation

namei fixes (5/19)

PATCH New Al Viro 1 participant 1 message May 19, 2005 VFS

lore
Share & tools
lore

Al Viro

author
#0 lore raw

PATCH 1/1 namei fixes (5/19)

(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.

----

fs/namei.c +2 -0
diff -urN RC12-rc4-4/fs/namei.c RC12-rc4-5/fs/namei.c
@@ -1524,8 +1524,10 @@
 	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;