summaryrefslogtreecommitdiff
path: root/fs/namei.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-01 13:29:55 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-01 13:29:55 -0800
commit331fee3cd31c3ec3641062ca01a71b79dbf58b40 (patch)
tree90fa1a59b0256c82f95853f60b5e551431a1eb43 /fs/namei.c
parentb3c3a9cf2a28ee4a8d0b62e2e58c61e9ca9bb47b (diff)
parenta77cfcb429ed98845a4e4df72473b8f37acd890b (diff)
downloadlwn-331fee3cd31c3ec3641062ca01a71b79dbf58b40.tar.gz
lwn-331fee3cd31c3ec3641062ca01a71b79dbf58b40.zip
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs fixes from Al Viro: "A bunch of fixes; the last one is this cycle regression, the rest are -stable fodder." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: fix off-by-one in argument passed by iterate_fd() to callbacks lookup_one_len: don't accept . and .. cifs: get rid of blind d_drop() in readdir nfs_lookup_revalidate(): fix a leak don't do blind d_drop() in nfs_prime_dcache()
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 937f9d50c84b..5f4cdf3ad913 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2131,6 +2131,11 @@ struct dentry *lookup_one_len(const char *name, struct dentry *base, int len)
if (!len)
return ERR_PTR(-EACCES);
+ if (unlikely(name[0] == '.')) {
+ if (len < 2 || (len == 2 && name[1] == '.'))
+ return ERR_PTR(-EACCES);
+ }
+
while (len--) {
c = *(const unsigned char *)name++;
if (c == '/' || c == '\0')