mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-29 17:25:38 +00:00
vm: fix vm_pgoff wrap in upward expansion
commit42c36f63ac
upstream. Commita626ca6a65
("vm: fix vm_pgoff wrap in stack expansion") fixed the case of an expanding mapping causing vm_pgoff wrapping when you had downward stack expansion. But there was another case where IA64 and PA-RISC expand mappings: upward expansion. This fixes that case too. Signed-off-by: Hugh Dickins <hughd@google.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
a2e441bdc3
commit
643e2dfa4f
@ -1677,9 +1677,12 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address)
|
||||
size = address - vma->vm_start;
|
||||
grow = (address - vma->vm_end) >> PAGE_SHIFT;
|
||||
|
||||
error = acct_stack_growth(vma, size, grow);
|
||||
if (!error)
|
||||
vma->vm_end = address;
|
||||
error = -ENOMEM;
|
||||
if (vma->vm_pgoff + (size >> PAGE_SHIFT) >= vma->vm_pgoff) {
|
||||
error = acct_stack_growth(vma, size, grow);
|
||||
if (!error)
|
||||
vma->vm_end = address;
|
||||
}
|
||||
}
|
||||
anon_vma_unlock(vma);
|
||||
return error;
|
||||
|
Loading…
Reference in New Issue
Block a user