Commit 70faa195 authored by Linus Torvalds's avatar Linus Torvalds

Don't allow mremap of zero-sized areas.

parent e37d5b22
...@@ -315,6 +315,10 @@ unsigned long do_mremap(unsigned long addr, ...@@ -315,6 +315,10 @@ unsigned long do_mremap(unsigned long addr,
old_len = PAGE_ALIGN(old_len); old_len = PAGE_ALIGN(old_len);
new_len = PAGE_ALIGN(new_len); new_len = PAGE_ALIGN(new_len);
/* Don't allow the degenerate cases */
if (!(old_len | new_len))
goto out;
/* new_addr is only valid if MREMAP_FIXED is specified */ /* new_addr is only valid if MREMAP_FIXED is specified */
if (flags & MREMAP_FIXED) { if (flags & MREMAP_FIXED) {
if (new_addr & ~PAGE_MASK) if (new_addr & ~PAGE_MASK)
......
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