]> git.neil.brown.name Git - history.git/commitdiff
Don't allow mremap of zero-sized areas.
authorLinus Torvalds <torvalds@home.osdl.org>
Mon, 5 Jan 2004 01:41:13 +0000 (17:41 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Mon, 5 Jan 2004 01:41:13 +0000 (17:41 -0800)
mm/mremap.c

index 0412a204cb6919f3f08a4ef67395058adaef67e3..ce523ef8555567e7734eefecf32761b8c412b7a0 100644 (file)
@@ -315,6 +315,10 @@ unsigned long do_mremap(unsigned long addr,
        old_len = PAGE_ALIGN(old_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 */
        if (flags & MREMAP_FIXED) {
                if (new_addr & ~PAGE_MASK)