]> git.hungrycats.org Git - linux/commitdiff
[PATCH] check do_munmap() failure
authorAndrew Morton <akpm@osdl.org>
Wed, 4 Feb 2004 02:42:26 +0000 (18:42 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Wed, 4 Feb 2004 02:42:26 +0000 (18:42 -0800)
From: Andrea Arcangeli <andrea@suse.de>

Return the proper error code

mm/mremap.c

index 5a93274fbd16891118d42067f45b072fe99e3e3c..85b492d23b4bb93898182da2b449950e587210d6 100644 (file)
@@ -346,7 +346,9 @@ unsigned long do_mremap(unsigned long addr,
                if ((addr <= new_addr) && (addr+old_len) > new_addr)
                        goto out;
 
-               do_munmap(current->mm, new_addr, new_len);
+               ret = do_munmap(current->mm, new_addr, new_len);
+               if (ret)
+                       goto out;
        }
 
        /*
@@ -354,9 +356,11 @@ unsigned long do_mremap(unsigned long addr,
         * the unnecessary pages..
         * do_munmap does all the needed commit accounting
         */
-       ret = addr;
        if (old_len >= new_len) {
-               do_munmap(current->mm, addr+new_len, old_len - new_len);
+               ret = do_munmap(current->mm, addr+new_len, old_len - new_len);
+               if (ret && old_len != new_len)
+                       goto out;
+               ret = addr;
                if (!(flags & MREMAP_FIXED) || (new_addr == addr))
                        goto out;
                old_len = new_len;