afs_mntpt_follow_link() actually does mntput before dput, which is wrong. Signed-off-by: Jan Blunck Signed-off-by: Andreas Gruenbacher --- fs/afs/mntpt.c | 3 +-- fs/namei.c | 15 +++++---------- 2 files changed, 6 insertions(+), 12 deletions(-) --- a/fs/afs/mntpt.c +++ b/fs/afs/mntpt.c @@ -235,8 +235,7 @@ static void *afs_mntpt_follow_link(struc err = do_add_mount(newmnt, nd, MNT_SHRINKABLE, &afs_vfsmounts); switch (err) { case 0: - mntput(nd->lookup.path.mnt); - dput(nd->lookup.path.dentry); + pathput(&nd->lookup.path); nd->lookup.path.mnt = newmnt; nd->lookup.path.dentry = dget(newmnt->mnt_root); schedule_delayed_work(&afs_mntpt_expiry_timer, --- a/fs/namei.c +++ b/fs/namei.c @@ -610,8 +610,7 @@ static __always_inline int __do_follow_l if (dentry->d_inode->i_op->put_link) dentry->d_inode->i_op->put_link(dentry, nd, cookie); } - dput(dentry); - mntput(path->mnt); + pathput(path); return error; } @@ -1016,8 +1015,7 @@ static int fastcall link_path_walk(const result = __link_path_walk(name, nd); } - dput(save.lookup.path.dentry); - mntput(save.lookup.path.mnt); + pathput(&save.lookup.path); return result; } @@ -1038,8 +1036,7 @@ static int __emul_lookup_dentry(const ch return 0; /* something went wrong... */ if (!nd->lookup.path.dentry->d_inode || S_ISDIR(nd->lookup.path.dentry->d_inode->i_mode)) { - struct dentry *old_dentry = nd->lookup.path.dentry; - struct vfsmount *old_mnt = nd->lookup.path.mnt; + struct path old_path = nd->lookup.path; struct qstr last = nd->last; int last_type = nd->last_type; struct fs_struct *fs = current->fs; @@ -1055,14 +1052,12 @@ static int __emul_lookup_dentry(const ch read_unlock(&fs->lock); if (path_walk(name, nd) == 0) { if (nd->lookup.path.dentry->d_inode) { - dput(old_dentry); - mntput(old_mnt); + pathput(&old_path); return 1; } pathput(&nd->lookup.path); } - nd->lookup.path.dentry = old_dentry; - nd->lookup.path.mnt = old_mnt; + nd->lookup.path = old_path; nd->last = last; nd->last_type = last_type; } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/