diff options
-rw-r--r-- | fs/namei.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/namei.c b/fs/namei.c index 82f9568d315d..907e24785576 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1849,13 +1849,7 @@ int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt, | |||
1849 | static struct dentry *__lookup_hash(struct qstr *name, | 1849 | static struct dentry *__lookup_hash(struct qstr *name, |
1850 | struct dentry *base, struct nameidata *nd) | 1850 | struct dentry *base, struct nameidata *nd) |
1851 | { | 1851 | { |
1852 | struct inode *inode = base->d_inode; | ||
1853 | struct dentry *dentry; | 1852 | struct dentry *dentry; |
1854 | int err; | ||
1855 | |||
1856 | err = inode_permission(inode, MAY_EXEC); | ||
1857 | if (err) | ||
1858 | return ERR_PTR(err); | ||
1859 | 1853 | ||
1860 | /* | 1854 | /* |
1861 | * Don't bother with __d_lookup: callers are for creat as | 1855 | * Don't bother with __d_lookup: callers are for creat as |
@@ -1922,6 +1916,7 @@ struct dentry *lookup_one_len(const char *name, struct dentry *base, int len) | |||
1922 | { | 1916 | { |
1923 | struct qstr this; | 1917 | struct qstr this; |
1924 | unsigned int c; | 1918 | unsigned int c; |
1919 | int err; | ||
1925 | 1920 | ||
1926 | WARN_ON_ONCE(!mutex_is_locked(&base->d_inode->i_mutex)); | 1921 | WARN_ON_ONCE(!mutex_is_locked(&base->d_inode->i_mutex)); |
1927 | 1922 | ||
@@ -1946,6 +1941,10 @@ struct dentry *lookup_one_len(const char *name, struct dentry *base, int len) | |||
1946 | return ERR_PTR(err); | 1941 | return ERR_PTR(err); |
1947 | } | 1942 | } |
1948 | 1943 | ||
1944 | err = inode_permission(base->d_inode, MAY_EXEC); | ||
1945 | if (err) | ||
1946 | return ERR_PTR(err); | ||
1947 | |||
1949 | return __lookup_hash(&this, base, NULL); | 1948 | return __lookup_hash(&this, base, NULL); |
1950 | } | 1949 | } |
1951 | 1950 | ||