diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2009-11-30 20:12:03 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-12-11 06:44:57 -0500 |
commit | 8c7b49b3ecd48923eb64ff57e07a1cdb74782970 (patch) | |
tree | 3bb2335ccaa34ef227459800c2221e71cf6b1987 /mm/mmap.c | |
parent | f8b7256096a20436f6d0926747e3ac3d64c81d24 (diff) |
fix a struct file leak in do_mmap_pgoff()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'mm/mmap.c')
-rw-r--r-- | mm/mmap.c | 18 |
1 files changed, 0 insertions, 18 deletions
@@ -948,24 +948,6 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, | |||
948 | if (mm->map_count > sysctl_max_map_count) | 948 | if (mm->map_count > sysctl_max_map_count) |
949 | return -ENOMEM; | 949 | return -ENOMEM; |
950 | 950 | ||
951 | if (flags & MAP_HUGETLB) { | ||
952 | struct user_struct *user = NULL; | ||
953 | if (file) | ||
954 | return -EINVAL; | ||
955 | |||
956 | /* | ||
957 | * VM_NORESERVE is used because the reservations will be | ||
958 | * taken when vm_ops->mmap() is called | ||
959 | * A dummy user value is used because we are not locking | ||
960 | * memory so no accounting is necessary | ||
961 | */ | ||
962 | len = ALIGN(len, huge_page_size(&default_hstate)); | ||
963 | file = hugetlb_file_setup(HUGETLB_ANON_FILE, len, VM_NORESERVE, | ||
964 | &user, HUGETLB_ANONHUGE_INODE); | ||
965 | if (IS_ERR(file)) | ||
966 | return PTR_ERR(file); | ||
967 | } | ||
968 | |||
969 | /* Obtain the address to map to. we verify (or select) it and ensure | 951 | /* Obtain the address to map to. we verify (or select) it and ensure |
970 | * that it represents a valid section of the address space. | 952 | * that it represents a valid section of the address space. |
971 | */ | 953 | */ |