do_remap takes a memory commitment about half way though. Error exits prior to this check unnecessarily as to whether we need to release this memory commitment. This patch clarifies the exit requirements. --- mremap.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff -upN reference/mm/mremap.c current/mm/mremap.c --- reference/mm/mremap.c 2004-02-23 18:15:13.000000000 +0000 +++ current/mm/mremap.c 2004-03-23 15:29:42.000000000 +0000 @@ -401,7 +401,7 @@ unsigned long do_mremap(unsigned long ad if (vma->vm_flags & VM_ACCOUNT) { charged = (new_len - old_len) >> PAGE_SHIFT; if (security_vm_enough_memory(charged)) - goto out_nc; + goto out; } /* old_len exactly to the end of the area.. @@ -426,7 +426,7 @@ unsigned long do_mremap(unsigned long ad addr + new_len); } ret = addr; - goto out; + goto out_rc; } } @@ -445,14 +445,14 @@ unsigned long do_mremap(unsigned long ad vma->vm_pgoff, map_flags); ret = new_addr; if (new_addr & ~PAGE_MASK) - goto out; + goto out_rc; } ret = move_vma(vma, addr, old_len, new_len, new_addr); } -out: +out_rc: if (ret & ~PAGE_MASK) vm_unacct_memory(charged); -out_nc: +out: return ret; }