aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/namei.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 527119afb6a5..5b961eb71cbf 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1698,8 +1698,11 @@ struct file *do_filp_open(int dfd, const char *pathname,
1698 if (error) 1698 if (error)
1699 return ERR_PTR(error); 1699 return ERR_PTR(error);
1700 error = path_walk(pathname, &nd); 1700 error = path_walk(pathname, &nd);
1701 if (error) 1701 if (error) {
1702 if (nd.root.mnt)
1703 path_put(&nd.root);
1702 return ERR_PTR(error); 1704 return ERR_PTR(error);
1705 }
1703 if (unlikely(!audit_dummy_context())) 1706 if (unlikely(!audit_dummy_context()))
1704 audit_inode(pathname, nd.path.dentry); 1707 audit_inode(pathname, nd.path.dentry);
1705 1708
@@ -1759,6 +1762,8 @@ do_last:
1759 } 1762 }
1760 filp = nameidata_to_filp(&nd, open_flag); 1763 filp = nameidata_to_filp(&nd, open_flag);
1761 mnt_drop_write(nd.path.mnt); 1764 mnt_drop_write(nd.path.mnt);
1765 if (nd.root.mnt)
1766 path_put(&nd.root);
1762 return filp; 1767 return filp;
1763 } 1768 }
1764 1769
@@ -1819,6 +1824,8 @@ ok:
1819 */ 1824 */
1820 if (will_write) 1825 if (will_write)
1821 mnt_drop_write(nd.path.mnt); 1826 mnt_drop_write(nd.path.mnt);
1827 if (nd.root.mnt)
1828 path_put(&nd.root);
1822 return filp; 1829 return filp;
1823 1830
1824exit_mutex_unlock: 1831exit_mutex_unlock:
@@ -1859,6 +1866,8 @@ do_link:
1859 * with "intent.open". 1866 * with "intent.open".
1860 */ 1867 */
1861 release_open_intent(&nd); 1868 release_open_intent(&nd);
1869 if (nd.root.mnt)
1870 path_put(&nd.root);
1862 return ERR_PTR(error); 1871 return ERR_PTR(error);
1863 } 1872 }
1864 nd.flags &= ~LOOKUP_PARENT; 1873 nd.flags &= ~LOOKUP_PARENT;