diff options
-rw-r--r-- | fs/namei.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/fs/namei.c b/fs/namei.c index 3c39fa1608c5..bff27c08134c 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1685,8 +1685,6 @@ static struct file *do_last(struct nameidata *nd, struct path *path, | |||
1685 | } | 1685 | } |
1686 | filp = nameidata_to_filp(nd); | 1686 | filp = nameidata_to_filp(nd); |
1687 | mnt_drop_write(nd->path.mnt); | 1687 | mnt_drop_write(nd->path.mnt); |
1688 | if (nd->root.mnt) | ||
1689 | path_put(&nd->root); | ||
1690 | if (!IS_ERR(filp)) { | 1688 | if (!IS_ERR(filp)) { |
1691 | error = ima_file_check(filp, acc_mode); | 1689 | error = ima_file_check(filp, acc_mode); |
1692 | if (error) { | 1690 | if (error) { |
@@ -1726,8 +1724,6 @@ static struct file *do_last(struct nameidata *nd, struct path *path, | |||
1726 | if (S_ISDIR(path->dentry->d_inode->i_mode)) | 1724 | if (S_ISDIR(path->dentry->d_inode->i_mode)) |
1727 | goto exit; | 1725 | goto exit; |
1728 | filp = finish_open(nd, open_flag, flag, acc_mode); | 1726 | filp = finish_open(nd, open_flag, flag, acc_mode); |
1729 | if (nd->root.mnt) | ||
1730 | path_put(&nd->root); | ||
1731 | return filp; | 1727 | return filp; |
1732 | 1728 | ||
1733 | exit_mutex_unlock: | 1729 | exit_mutex_unlock: |
@@ -1737,8 +1733,6 @@ exit_dput: | |||
1737 | exit: | 1733 | exit: |
1738 | if (!IS_ERR(nd->intent.open.file)) | 1734 | if (!IS_ERR(nd->intent.open.file)) |
1739 | release_open_intent(nd); | 1735 | release_open_intent(nd); |
1740 | if (nd->root.mnt) | ||
1741 | path_put(&nd->root); | ||
1742 | path_put(&nd->path); | 1736 | path_put(&nd->path); |
1743 | return ERR_PTR(error); | 1737 | return ERR_PTR(error); |
1744 | } | 1738 | } |
@@ -1857,6 +1851,8 @@ do_last: | |||
1857 | pathname, dir, &is_link); | 1851 | pathname, dir, &is_link); |
1858 | if (is_link) | 1852 | if (is_link) |
1859 | goto do_link; | 1853 | goto do_link; |
1854 | if (nd.root.mnt) | ||
1855 | path_put(&nd.root); | ||
1860 | return filp; | 1856 | return filp; |
1861 | 1857 | ||
1862 | ok: | 1858 | ok: |