Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 174846
b: refs/heads/master
c: f106af4
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro committed Dec 11, 2009
1 parent d6b7b0b commit fdd26bd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 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: 1a0ef85f84feb13f07b604fcf5b90ef7c2b5c82f
refs/heads/master: f106af4e90eadd76cfc0b5325f659619e08fb762
13 changes: 11 additions & 2 deletions trunk/mm/mremap.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@

#include "internal.h"

#ifndef arch_mmap_check
#define arch_mmap_check(addr, len, flags) (0)
#endif

static pmd_t *get_old_pmd(struct mm_struct *mm, unsigned long addr)
{
pgd_t *pgd;
Expand Down Expand Up @@ -368,12 +372,17 @@ static unsigned long mremap_to(unsigned long addr,

static int vma_expandable(struct vm_area_struct *vma, unsigned long delta)
{
unsigned long end = vma->vm_end + delta;
unsigned long max_addr = TASK_SIZE;
if (vma->vm_next)
max_addr = vma->vm_next->vm_start;
if (max_addr - vma->vm_end < delta)
if (max_addr < end || end < vma->vm_end)
return 0;
if (arch_mmap_check(vma->vm_start, end - vma->vm_start, MAP_FIXED))
return 0;
if (get_unmapped_area(NULL, vma->vm_start, end - vma->vm_start,
0, MAP_FIXED) & ~PAGE_MASK)
return 0;
/* we need to do arch-specific checks here */
return 1;
}

Expand Down

0 comments on commit fdd26bd

Please sign in to comment.