Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 310043
b: refs/heads/master
c: dc98250
h: refs/heads/master
i:
  310041: 0eb5e9a
  310039: c58e7f6
v: v3
  • Loading branch information
Al Viro committed Jun 1, 2012
1 parent 138bfb8 commit af92ecd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 23 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: e3fc629d7bb70848fbf479688a66d4e76dff46ac
refs/heads/master: dc982501d9643ab0c117e7d87562857ce234652d
16 changes: 5 additions & 11 deletions trunk/mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1102,28 +1102,22 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
return mmap_region(file, addr, len, flags, vm_flags, pgoff);
}

static unsigned long do_mmap(struct file *file, unsigned long addr,
unsigned long vm_mmap(struct file *file, unsigned long addr,
unsigned long len, unsigned long prot,
unsigned long flag, unsigned long offset)
{
unsigned long ret;
struct mm_struct *mm = current->mm;

if (unlikely(offset + PAGE_ALIGN(len) < offset))
return -EINVAL;
if (unlikely(offset & ~PAGE_MASK))
return -EINVAL;
return do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT);
}

unsigned long vm_mmap(struct file *file, unsigned long addr,
unsigned long len, unsigned long prot,
unsigned long flag, unsigned long offset)
{
unsigned long ret;
struct mm_struct *mm = current->mm;

ret = security_mmap_file(file, prot, flag);
if (!ret) {
down_write(&mm->mmap_sem);
ret = do_mmap(file, addr, len, prot, flag, offset);
ret = do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT);
up_write(&mm->mmap_sem);
}
return ret;
Expand Down
16 changes: 5 additions & 11 deletions trunk/mm/nommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1470,28 +1470,22 @@ unsigned long do_mmap_pgoff(struct file *file,
return -ENOMEM;
}

static unsigned long do_mmap(struct file *file, unsigned long addr,
unsigned long vm_mmap(struct file *file, unsigned long addr,
unsigned long len, unsigned long prot,
unsigned long flag, unsigned long offset)
{
unsigned long ret;
struct mm_struct *mm = current->mm;

if (unlikely(offset + PAGE_ALIGN(len) < offset))
return -EINVAL;
if (unlikely(offset & ~PAGE_MASK))
return -EINVAL;
return do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT);
}

unsigned long vm_mmap(struct file *file, unsigned long addr,
unsigned long len, unsigned long prot,
unsigned long flag, unsigned long offset)
{
unsigned long ret;
struct mm_struct *mm = current->mm;

ret = security_mmap_file(file, prot, flag);
if (!ret) {
down_write(&mm->mmap_sem);
ret = do_mmap(file, addr, len, prot, flag, offset);
ret = do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT);
up_write(&mm->mmap_sem);
}
return ret;
Expand Down

0 comments on commit af92ecd

Please sign in to comment.