diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2017-04-15 17:29:14 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2017-04-21 14:05:35 -0400 |
commit | 93893862fb7ba704ec5a6872a294c9cc2b0d4ca3 (patch) | |
tree | 0281c6a58d798efa4436ad0d2ad54c02d8e6a0fb | |
parent | 159b095628851966b5fbf2637b0c40709911ca88 (diff) |
path_init(): don't bother with checking MAY_EXEC for LOOKUP_ROOT
we'll hit that check in link_path_walk() anyway.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/namei.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/fs/namei.c b/fs/namei.c index 19dcf62133cc..60c0a78ebca7 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -2142,7 +2142,6 @@ OK: | |||
2142 | 2142 | ||
2143 | static const char *path_init(struct nameidata *nd, unsigned flags) | 2143 | static const char *path_init(struct nameidata *nd, unsigned flags) |
2144 | { | 2144 | { |
2145 | int retval = 0; | ||
2146 | const char *s = nd->name->name; | 2145 | const char *s = nd->name->name; |
2147 | 2146 | ||
2148 | if (!*s) | 2147 | if (!*s) |
@@ -2154,13 +2153,8 @@ static const char *path_init(struct nameidata *nd, unsigned flags) | |||
2154 | if (flags & LOOKUP_ROOT) { | 2153 | if (flags & LOOKUP_ROOT) { |
2155 | struct dentry *root = nd->root.dentry; | 2154 | struct dentry *root = nd->root.dentry; |
2156 | struct inode *inode = root->d_inode; | 2155 | struct inode *inode = root->d_inode; |
2157 | if (*s) { | 2156 | if (*s && unlikely(!d_can_lookup(root))) |
2158 | if (!d_can_lookup(root)) | 2157 | return ERR_PTR(-ENOTDIR); |
2159 | return ERR_PTR(-ENOTDIR); | ||
2160 | retval = inode_permission(inode, MAY_EXEC); | ||
2161 | if (retval) | ||
2162 | return ERR_PTR(retval); | ||
2163 | } | ||
2164 | nd->path = nd->root; | 2158 | nd->path = nd->root; |
2165 | nd->inode = inode; | 2159 | nd->inode = inode; |
2166 | if (flags & LOOKUP_RCU) { | 2160 | if (flags & LOOKUP_RCU) { |