diff options
author | Andrew Morton <akpm@osdl.org> | 2004-02-03 18:42:26 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@home.osdl.org> | 2004-02-03 18:42:26 -0800 |
commit | 59287e5eef8d33dcd842852a898b43a81fe0b2c2 (patch) | |
tree | 7803427464bfe065c656276e1ce627bebb603619 | |
parent | 1ea604a4e810ba0298ab4973f06fe6f078c82478 (diff) | |
download | history-59287e5eef8d33dcd842852a898b43a81fe0b2c2.tar.gz |
[PATCH] check do_munmap() failure
From: Andrea Arcangeli <andrea@suse.de>
Return the proper error code
-rw-r--r-- | mm/mremap.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/mm/mremap.c b/mm/mremap.c index 5a93274fbd1689..85b492d23b4bb9 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -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; |