]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
fix page leak during core dump
authorBrian Pomerantz <bapper@piratehaven.org>
Mon, 2 Apr 2007 06:49:41 +0000 (23:49 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 13 Apr 2007 20:47:18 +0000 (13:47 -0700)
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: Brian 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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/binfmt_elf.c
fs/binfmt_elf_fdpic.c

index 51db1182b27e4470edbc6945574aa1158a110bea..b172b0160f5cdad24aad8f032937a126a2fd40e7 100644 (file)
@@ -1704,7 +1704,10 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
                                DUMP_SEEK(PAGE_SIZE);
                        } else {
                                if (page == ZERO_PAGE(addr)) {
-                                       DUMP_SEEK(PAGE_SIZE);
+                                       if (!dump_seek(file, PAGE_SIZE)) {
+                                               page_cache_release(page);
+                                               goto end_coredump;
+                                       }
                                } else {
                                        void *kaddr;
                                        flush_cache_page(vma, addr,
index a4d933a51208c5bcbfdd182b2412c3b1d369c140..a852eb7b5a5dd32ab95ba3f0c168df3975cd97aa 100644 (file)
@@ -1473,8 +1473,8 @@ static int elf_fdpic_dump_segments(struct file *file, struct mm_struct *mm,
                                DUMP_SEEK(file->f_pos + PAGE_SIZE);
                        }
                        else if (page == ZERO_PAGE(addr)) {
-                               DUMP_SEEK(file->f_pos + PAGE_SIZE);
                                page_cache_release(page);
+                               DUMP_SEEK(file->f_pos + PAGE_SIZE);
                        }
                        else {
                                void *kaddr;