Return proper sys_munmap() error code --- linux-2.2.25/mm/mremap.c~ Wed Feb 18 17:39:06 2004 +++ linux-2.2.25/mm/mremap.c Wed Feb 18 17:39:06 2004 @@ -176,9 +176,11 @@ * Always allow a shrinking remap: that just unmaps * the unnecessary pages.. */ - ret = addr; if (old_len >= new_len) { - do_munmap(addr+new_len, old_len - new_len); + ret = do_munmap(addr+new_len, old_len - new_len); + if (ret && old_len != new_len) + goto out; + ret = addr; goto out; }