Commit 8d849f5b authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] fix memory leak while coredumping

From: IWAMOTO Toshihiro <iwamoto@valinux.co.jp>

This patch fixes a memory leak that happens when a core file hits the
process's resource limit.
parent 4ec5d5d2
......@@ -1448,7 +1448,13 @@ static int elf_core_dump(long signr, struct pt_regs * regs, struct file * file)
void *kaddr;
flush_cache_page(vma, addr);
kaddr = kmap(page);
DUMP_WRITE(kaddr, PAGE_SIZE);
if ((size += PAGE_SIZE) > limit ||
!dump_write(file, kaddr,
PAGE_SIZE)) {
kunmap(page);
page_cache_release(page);
goto end_coredump;
}
kunmap(page);
}
page_cache_release(page);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment