diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/namei.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/namei.c b/fs/namei.c index 5153f57ee6b3..411bb3243c36 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -543,11 +543,15 @@ static inline int do_follow_link(struct path *path, struct nameidata *nd) | |||
543 | current->link_count++; | 543 | current->link_count++; |
544 | current->total_link_count++; | 544 | current->total_link_count++; |
545 | nd->depth++; | 545 | nd->depth++; |
546 | if (path->mnt != nd->mnt) | ||
547 | mntput(nd->mnt); | ||
546 | err = __do_follow_link(path, nd); | 548 | err = __do_follow_link(path, nd); |
547 | current->link_count--; | 549 | current->link_count--; |
548 | nd->depth--; | 550 | nd->depth--; |
549 | return err; | 551 | return err; |
550 | loop: | 552 | loop: |
553 | if (path->mnt != nd->mnt) | ||
554 | mntput(nd->mnt); | ||
551 | dput(path->dentry); | 555 | dput(path->dentry); |
552 | path_release(nd); | 556 | path_release(nd); |
553 | return err; | 557 | return err; |
@@ -801,8 +805,6 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd) | |||
801 | goto out_dput; | 805 | goto out_dput; |
802 | 806 | ||
803 | if (inode->i_op->follow_link) { | 807 | if (inode->i_op->follow_link) { |
804 | if (nd->mnt != next.mnt) | ||
805 | mntput(nd->mnt); | ||
806 | err = do_follow_link(&next, nd); | 808 | err = do_follow_link(&next, nd); |
807 | if (err) | 809 | if (err) |
808 | goto return_err; | 810 | goto return_err; |
@@ -856,8 +858,6 @@ last_component: | |||
856 | inode = next.dentry->d_inode; | 858 | inode = next.dentry->d_inode; |
857 | if ((lookup_flags & LOOKUP_FOLLOW) | 859 | if ((lookup_flags & LOOKUP_FOLLOW) |
858 | && inode && inode->i_op && inode->i_op->follow_link) { | 860 | && inode && inode->i_op && inode->i_op->follow_link) { |
859 | if (next.mnt != nd->mnt) | ||
860 | mntput(nd->mnt); | ||
861 | err = do_follow_link(&next, nd); | 861 | err = do_follow_link(&next, nd); |
862 | if (err) | 862 | if (err) |
863 | goto return_err; | 863 | goto return_err; |