Skip to content

Commit

Permalink
mm/hwpoison: fix refcount of THP head page in no-injection case
Browse files Browse the repository at this point in the history
Hwpoison injection takes a refcount of target page and another refcount
of head page of THP if the target page is the tail page of a THP.
However, current code doesn't release the refcount of head page if the
THP is not supported to be injected wrt hwpoison filter.

Fix it by reducing the refcount of head page if the target page is the
tail page of a THP and it is not supported to be injected.

Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
Acked-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Wanpeng Li authored and torvalds committed Sep 8, 2015
1 parent 94bf4ec commit be91748
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/hwpoison-inject.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static int hwpoison_inject(void *data, u64 val)
pr_info("Injecting memory failure at pfn %#lx\n", pfn);
return memory_failure(pfn, 18, MF_COUNT_INCREASED);
put_out:
put_page(p);
put_hwpoison_page(p);
return 0;
}

Expand Down

0 comments on commit be91748

Please sign in to comment.