提交 b87faca9 编写于 作者: N Naoya Horiguchi 提交者: Yang Yingliang

mm,hwpoison-inject: don't pin for hwpoison_filter

mainline inclusion
from linux-v5.10-rc1
commit fd476720
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4LE22
CVE: NA

--------------------------------

Another memory error injection interface debugfs:hwpoison/corrupt-pfn also
takes bogus refcount for hwpoison_filter().  It's justified because this
does a coarse filter, expecting that memory_failure() redoes the check for
sure.
Signed-off-by: NNaoya Horiguchi <naoya.horiguchi@nec.com>
Signed-off-by: NOscar Salvador <osalvador@suse.de>
Signed-off-by: NMa Wupeng <mawupeng1@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 85a60ad1
...@@ -25,11 +25,6 @@ static int hwpoison_inject(void *data, u64 val) ...@@ -25,11 +25,6 @@ static int hwpoison_inject(void *data, u64 val)
p = pfn_to_page(pfn); p = pfn_to_page(pfn);
hpage = compound_head(p); hpage = compound_head(p);
/*
* This implies unable to support free buddy pages.
*/
if (!get_hwpoison_page(p))
return 0;
if (!hwpoison_filter_enable) if (!hwpoison_filter_enable)
goto inject; goto inject;
...@@ -39,23 +34,20 @@ static int hwpoison_inject(void *data, u64 val) ...@@ -39,23 +34,20 @@ static int hwpoison_inject(void *data, u64 val)
* This implies unable to support non-LRU pages. * This implies unable to support non-LRU pages.
*/ */
if (!PageLRU(hpage) && !PageHuge(p)) if (!PageLRU(hpage) && !PageHuge(p))
goto put_out; return 0;
/* /*
* do a racy check with elevated page count, to make sure PG_hwpoison * do a racy check to make sure PG_hwpoison will only be set for
* will only be set for the targeted owner (or on a free page). * the targeted owner (or on a free page).
* memory_failure() will redo the check reliably inside page lock. * memory_failure() will redo the check reliably inside page lock.
*/ */
err = hwpoison_filter(hpage); err = hwpoison_filter(hpage);
if (err) if (err)
goto put_out; return 0;
inject: inject:
pr_info("Injecting memory failure at pfn %#lx\n", pfn); pr_info("Injecting memory failure at pfn %#lx\n", pfn);
return memory_failure(pfn, MF_COUNT_INCREASED); return memory_failure(pfn, 0);
put_out:
put_hwpoison_page(p);
return 0;
} }
static int hwpoison_unpoison(void *data, u64 val) static int hwpoison_unpoison(void *data, u64 val)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册