summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-10-10 15:25:26 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-10-12 00:32:03 -0400
commita608ca21f58ee44df5a71ba140e98498f3ebc2cd (patch)
tree4ba6f5d5414ba9b579c8e41eb30c21a709537922 /include
parent4fa6b5ecbf092c6ee752ece8a55d71f663d23254 (diff)
vfs: allocate page instead of names_cache buffer in mount_block_root
First, it's incorrect to call putname() after __getname_gfp() since the bare __getname_gfp() call skips the auditing code, while putname() doesn't. mount_block_root allocates a PATH_MAX buffer via __getname_gfp, and then calls get_fs_names to fill the buffer. That function can call get_filesystem_list which assumes that that buffer is a full page in size. On arches where PAGE_SIZE != 4k, then this could potentially overrun. In practice, it's hard to imagine the list of filesystem names even approaching 4k, but it's best to be safe. Just allocate a page for this purpose instead. With this, we can also remove the __getname_gfp() definition since there are no more callers. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include')
-rw-r--r--include/linux/fs.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 8ef2fc9f1f08..b44b4ca82164 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2228,8 +2228,7 @@ extern void __init vfs_caches_init(unsigned long);
extern struct kmem_cache *names_cachep;
-#define __getname_gfp(gfp) kmem_cache_alloc(names_cachep, (gfp))
-#define __getname() __getname_gfp(GFP_KERNEL)
+#define __getname() kmem_cache_alloc(names_cachep, GFP_KERNEL)
#define __putname(name) kmem_cache_free(names_cachep, (void *)(name))
#ifndef CONFIG_AUDITSYSCALL
#define putname(name) __putname(name)