Commit 03221702 authored by Brian Pomerantz's avatar Brian Pomerantz Committed by Linus Torvalds

[PATCH] fix page leak during core dump

When the dump cannot occur most likely because of a full file system and
the page to be written is the zero page, the call to page_cache_release()
is missed.
Signed-off-by: default avatarBrian Pomerantz <bapper@mvista.com>
Cc: Hugh Dickins <hugh@veritas.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: David Howells <dhowells@redhat.com>
Cc: <stable@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 2400ff77
...@@ -1704,7 +1704,10 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file) ...@@ -1704,7 +1704,10 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
DUMP_SEEK(PAGE_SIZE); DUMP_SEEK(PAGE_SIZE);
} else { } else {
if (page == ZERO_PAGE(addr)) { if (page == ZERO_PAGE(addr)) {
DUMP_SEEK(PAGE_SIZE); if (!dump_seek(file, PAGE_SIZE)) {
page_cache_release(page);
goto end_coredump;
}
} else { } else {
void *kaddr; void *kaddr;
flush_cache_page(vma, addr, flush_cache_page(vma, addr,
......
...@@ -1480,8 +1480,8 @@ static int elf_fdpic_dump_segments(struct file *file, struct mm_struct *mm, ...@@ -1480,8 +1480,8 @@ static int elf_fdpic_dump_segments(struct file *file, struct mm_struct *mm,
DUMP_SEEK(file->f_pos + PAGE_SIZE); DUMP_SEEK(file->f_pos + PAGE_SIZE);
} }
else if (page == ZERO_PAGE(addr)) { else if (page == ZERO_PAGE(addr)) {
DUMP_SEEK(file->f_pos + PAGE_SIZE);
page_cache_release(page); page_cache_release(page);
DUMP_SEEK(file->f_pos + PAGE_SIZE);
} }
else { else {
void *kaddr; void *kaddr;
......
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