HWPOISON: Fix page count leak in hwpoison late kill in do_swap_page
authorAndi Kleen <ak@linux.intel.com>
Tue, 13 Oct 2009 23:51:41 +0000 (01:51 +0200)
committerAndi Kleen <ak@linux.intel.com>
Mon, 19 Oct 2009 05:29:20 +0000 (07:29 +0200)
When returning due to a poisoned page drop the page count.

It wasn't a fatal problem because noone cares about the page count
on a poisoned page (except when it wraps), but it's cleaner to fix it.

Pointed out by Linus.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
mm/memory.c

index 7e91b5f9f690e4ae9d7c3e58bc1530c995311089..7a3b0ad5594aaab60308529e974840d671dad1a2 100644 (file)
@@ -2539,7 +2539,7 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma,
        } else if (PageHWPoison(page)) {
                ret = VM_FAULT_HWPOISON;
                delayacct_clear_flag(DELAYACCT_PF_SWAPIN);
-               goto out;
+               goto out_release;
        }
 
        lock_page(page);
@@ -2611,6 +2611,7 @@ out_nomap:
        pte_unmap_unlock(page_table, ptl);
 out_page:
        unlock_page(page);
+out_release:
        page_cache_release(page);
        return ret;
 }