Skip to content

Commit

Permalink
HWPOISON: Fix page count leak in hwpoison late kill in do_swap_page
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andi Kleen committed Oct 19, 2009
1 parent e43c3af commit 4779cb3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mm/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -2611,6 +2611,7 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma,
pte_unmap_unlock(page_table, ptl);
out_page:
unlock_page(page);
out_release:
page_cache_release(page);
return ret;
}
Expand Down

0 comments on commit 4779cb3

Please sign in to comment.