diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/mmap.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -1536,9 +1536,14 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address) | |||
1536 | * vma->vm_start/vm_end cannot change under us because the caller | 1536 | * vma->vm_start/vm_end cannot change under us because the caller |
1537 | * is required to hold the mmap_sem in read mode. We need the | 1537 | * is required to hold the mmap_sem in read mode. We need the |
1538 | * anon_vma lock to serialize against concurrent expand_stacks. | 1538 | * anon_vma lock to serialize against concurrent expand_stacks. |
1539 | * Also guard against wrapping around to address 0. | ||
1539 | */ | 1540 | */ |
1540 | address += 4 + PAGE_SIZE - 1; | 1541 | if (address < PAGE_ALIGN(address+4)) |
1541 | address &= PAGE_MASK; | 1542 | address = PAGE_ALIGN(address+4); |
1543 | else { | ||
1544 | anon_vma_unlock(vma); | ||
1545 | return -ENOMEM; | ||
1546 | } | ||
1542 | error = 0; | 1547 | error = 0; |
1543 | 1548 | ||
1544 | /* Somebody else might have raced and expanded it already */ | 1549 | /* Somebody else might have raced and expanded it already */ |