Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 174856
b: refs/heads/master
c: 8c7b49b
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro committed Dec 11, 2009
1 parent a903e99 commit d859993
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f8b7256096a20436f6d0926747e3ac3d64c81d24
refs/heads/master: 8c7b49b3ecd48923eb64ff57e07a1cdb74782970
18 changes: 0 additions & 18 deletions trunk/mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -948,24 +948,6 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
if (mm->map_count > sysctl_max_map_count)
return -ENOMEM;

if (flags & MAP_HUGETLB) {
struct user_struct *user = NULL;
if (file)
return -EINVAL;

/*
* VM_NORESERVE is used because the reservations will be
* taken when vm_ops->mmap() is called
* A dummy user value is used because we are not locking
* memory so no accounting is necessary
*/
len = ALIGN(len, huge_page_size(&default_hstate));
file = hugetlb_file_setup(HUGETLB_ANON_FILE, len, VM_NORESERVE,
&user, HUGETLB_ANONHUGE_INODE);
if (IS_ERR(file))
return PTR_ERR(file);
}

/* Obtain the address to map to. we verify (or select) it and ensure
* that it represents a valid section of the address space.
*/
Expand Down
15 changes: 15 additions & 0 deletions trunk/mm/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,24 @@ SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len,
unsigned long retval = -EBADF;

if (!(flags & MAP_ANONYMOUS)) {
if (unlikely(flags & MAP_HUGETLB))
return -EINVAL;
file = fget(fd);
if (!file)
goto out;
} else if (flags & MAP_HUGETLB) {
struct user_struct *user = NULL;
/*
* VM_NORESERVE is used because the reservations will be
* taken when vm_ops->mmap() is called
* A dummy user value is used because we are not locking
* memory so no accounting is necessary
*/
len = ALIGN(len, huge_page_size(&default_hstate));
file = hugetlb_file_setup(HUGETLB_ANON_FILE, len, VM_NORESERVE,
&user, HUGETLB_ANONHUGE_INODE);
if (IS_ERR(file))
return PTR_ERR(file);
}

flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
Expand Down

0 comments on commit d859993

Please sign in to comment.