Commit 06b32f3a authored by Helge Deller's avatar Helge Deller Committed by Kyle McMartin

[PARISC] Handle wrapping in expand_upwards()

Function expand_upwards() did not guarded against wrapping
around to address 0. This fixes the adjtimex02 testcase from
the Linux Test Project on a 32bit PARISC kernel.

[expand_upwards is only used on parisc and ia64; it looks like it does
 the right thing on both. --kyle]
Signed-off-by: default avatarHelge Deller <deller@gmx.de>
Cc: Tony Luck <tony.luck@intel.com>
Signed-off-by: default avatarKyle McMartin <kyle@parisc-linux.org>
parent d2f1c0fa
...@@ -1536,9 +1536,14 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address) ...@@ -1536,9 +1536,14 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address)
* vma->vm_start/vm_end cannot change under us because the caller * vma->vm_start/vm_end cannot change under us because the caller
* is required to hold the mmap_sem in read mode. We need the * is required to hold the mmap_sem in read mode. We need the
* anon_vma lock to serialize against concurrent expand_stacks. * anon_vma lock to serialize against concurrent expand_stacks.
* Also guard against wrapping around to address 0.
*/ */
address += 4 + PAGE_SIZE - 1; if (address < PAGE_ALIGN(address+4))
address &= PAGE_MASK; address = PAGE_ALIGN(address+4);
else {
anon_vma_unlock(vma);
return -ENOMEM;
}
error = 0; error = 0;
/* Somebody else might have raced and expanded it already */ /* Somebody else might have raced and expanded it already */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment