Commit 11e86a4a authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] afs ->follow_link() fixes

* fixed leaks on failure exits
* got rid of useless struct nameidata instance
Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f0c3ad0c
......@@ -235,8 +235,8 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt)
*/
static int afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd)
{
struct nameidata newnd;
struct vfsmount *newmnt;
struct dentry *old_dentry;
int err;
kenter("%p{%s},{%s:%p{%s}}",
......@@ -247,15 +247,19 @@ static int afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd)
nd->dentry->d_name.name);
newmnt = afs_mntpt_do_automount(dentry);
if (IS_ERR(newmnt))
if (IS_ERR(newmnt)) {
path_release(nd);
return PTR_ERR(newmnt);
}
newnd = *nd;
newnd.dentry = dentry;
err = do_add_mount(newmnt, &newnd, 0, &afs_vfsmounts);
old_dentry = nd->dentry;
nd->dentry = dentry;
err = do_add_mount(newmnt, nd, 0, &afs_vfsmounts);
nd->dentry = old_dentry;
path_release(nd);
if (!err) {
path_release(nd);
mntget(newmnt);
nd->mnt = newmnt;
dget(newmnt->mnt_root);
......
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