linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/hwpoison: reset hwpoison filter parameters in pfn_inject_exit()
@ 2024-07-15 10:28 Miaohe Lin
  2024-07-15 20:33 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Miaohe Lin @ 2024-07-15 10:28 UTC (permalink / raw)
  To: akpm; +Cc: nao.horiguchi, linmiaohe, linux-mm, linux-kernel

When hwpoison_inject module is removed, hwpoison_filter_* parameters
should be reset. Otherwise these parameters will have non-default values
at next insmod time.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/hwpoison-inject.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/mm/hwpoison-inject.c b/mm/hwpoison-inject.c
index 7ecaa1900137..b0bd11133a1d 100644
--- a/mm/hwpoison-inject.c
+++ b/mm/hwpoison-inject.c
@@ -64,9 +64,20 @@ static int hwpoison_unpoison(void *data, u64 val)
 DEFINE_DEBUGFS_ATTRIBUTE(hwpoison_fops, NULL, hwpoison_inject, "%lli\n");
 DEFINE_DEBUGFS_ATTRIBUTE(unpoison_fops, NULL, hwpoison_unpoison, "%lli\n");
 
-static void __exit pfn_inject_exit(void)
+static inline void reset_hwpoison_filter(void)
 {
 	hwpoison_filter_enable = 0;
+	hwpoison_filter_dev_major = ~0U;
+	hwpoison_filter_dev_minor = ~0U;
+	hwpoison_filter_flags_mask = 0;
+	hwpoison_filter_flags_value = 0;
+#ifdef CONFIG_MEMCG
+	hwpoison_filter_memcg = 0;
+#endif
+}
+
+static void __exit pfn_inject_exit(void)
+{
 	debugfs_remove_recursive(hwpoison_dir);
 }
 
-- 
2.33.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-16  2:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-15 10:28 [PATCH] mm/hwpoison: reset hwpoison filter parameters in pfn_inject_exit() Miaohe Lin
2024-07-15 20:33 ` Andrew Morton
2024-07-16  2:37   ` Miaohe Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox