Commit 03221702608c60b470fc86a23bdf4bc30e5bd59f

Authored by Brian Pomerantz
Committed by Linus Torvalds
1 parent 2400ff77e7

[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: 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: Linus Torvalds <torvalds@linux-foundation.org>

Showing 2 changed files with 5 additions and 2 deletions Side-by-side Diff

... ... @@ -1704,7 +1704,10 @@
1704 1704 DUMP_SEEK(PAGE_SIZE);
1705 1705 } else {
1706 1706 if (page == ZERO_PAGE(addr)) {
1707   - DUMP_SEEK(PAGE_SIZE);
  1707 + if (!dump_seek(file, PAGE_SIZE)) {
  1708 + page_cache_release(page);
  1709 + goto end_coredump;
  1710 + }
1708 1711 } else {
1709 1712 void *kaddr;
1710 1713 flush_cache_page(vma, addr,
fs/binfmt_elf_fdpic.c
... ... @@ -1480,8 +1480,8 @@
1480 1480 DUMP_SEEK(file->f_pos + PAGE_SIZE);
1481 1481 }
1482 1482 else if (page == ZERO_PAGE(addr)) {
1483   - DUMP_SEEK(file->f_pos + PAGE_SIZE);
1484 1483 page_cache_release(page);
  1484 + DUMP_SEEK(file->f_pos + PAGE_SIZE);
1485 1485 }
1486 1486 else {
1487 1487 void *kaddr;