Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

vm: fix vm_pgoff wrap in upward expansion

Commit a626ca6a6564 ("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>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Hugh Dickins and committed by
Linus Torvalds
42c36f63 c191f6cc

+7 -4
+7 -4
mm/mmap.c
··· 1767 1767 size = address - vma->vm_start; 1768 1768 grow = (address - vma->vm_end) >> PAGE_SHIFT; 1769 1769 1770 - error = acct_stack_growth(vma, size, grow); 1771 - if (!error) { 1772 - vma->vm_end = address; 1773 - perf_event_mmap(vma); 1770 + error = -ENOMEM; 1771 + if (vma->vm_pgoff + (size >> PAGE_SHIFT) >= vma->vm_pgoff) { 1772 + error = acct_stack_growth(vma, size, grow); 1773 + if (!error) { 1774 + vma->vm_end = address; 1775 + perf_event_mmap(vma); 1776 + } 1774 1777 } 1775 1778 } 1776 1779 vma_unlock_anon_vma(vma);