aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 94a5e60779f9..a4855af776a8 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -823,6 +823,17 @@ fail:
823} 823}
824 824
825/* 825/*
826 * This is a temporary kludge to deal with "automount" symlinks; proper
827 * solution is to trigger them on follow_mount(), so that do_lookup()
828 * would DTRT. To be killed before 2.6.34-final.
829 */
830static inline int follow_on_final(struct inode *inode, unsigned lookup_flags)
831{
832 return inode && unlikely(inode->i_op->follow_link) &&
833 ((lookup_flags & LOOKUP_FOLLOW) || S_ISDIR(inode->i_mode));
834}
835
836/*
826 * Name resolution. 837 * Name resolution.
827 * This is the basic name resolution function, turning a pathname into 838 * This is the basic name resolution function, turning a pathname into
828 * the final dentry. We expect 'base' to be positive and a directory. 839 * the final dentry. We expect 'base' to be positive and a directory.
@@ -942,8 +953,7 @@ last_component:
942 if (err) 953 if (err)
943 break; 954 break;
944 inode = next.dentry->d_inode; 955 inode = next.dentry->d_inode;
945 if ((lookup_flags & LOOKUP_FOLLOW) 956 if (follow_on_final(inode, lookup_flags)) {
946 && inode && inode->i_op->follow_link) {
947 err = do_follow_link(&next, nd); 957 err = do_follow_link(&next, nd);
948 if (err) 958 if (err)
949 goto return_err; 959 goto return_err;
@@ -1736,8 +1746,7 @@ do_last:
1736 if (nd.root.mnt) 1746 if (nd.root.mnt)
1737 path_put(&nd.root); 1747 path_put(&nd.root);
1738 if (!IS_ERR(filp)) { 1748 if (!IS_ERR(filp)) {
1739 error = ima_path_check(&filp->f_path, filp->f_mode & 1749 error = ima_file_check(filp, acc_mode);
1740 (MAY_READ | MAY_WRITE | MAY_EXEC));
1741 if (error) { 1750 if (error) {
1742 fput(filp); 1751 fput(filp);
1743 filp = ERR_PTR(error); 1752 filp = ERR_PTR(error);
@@ -1797,8 +1806,7 @@ ok:
1797 } 1806 }
1798 filp = nameidata_to_filp(&nd); 1807 filp = nameidata_to_filp(&nd);
1799 if (!IS_ERR(filp)) { 1808 if (!IS_ERR(filp)) {
1800 error = ima_path_check(&filp->f_path, filp->f_mode & 1809 error = ima_file_check(filp, acc_mode);
1801 (MAY_READ | MAY_WRITE | MAY_EXEC));
1802 if (error) { 1810 if (error) {
1803 fput(filp); 1811 fput(filp);
1804 filp = ERR_PTR(error); 1812 filp = ERR_PTR(error);