All of lore.kernel.org
 help / color / mirror / Atom feed
diff for duplicates of <20161202151935.GR6830@dhcp22.suse.cz>

diff --git a/a/1.txt b/N1/1.txt
index 819caef..8bf92d7 100644
--- a/a/1.txt
+++ b/N1/1.txt
@@ -57,3 +57,68 @@ OK, this is still only compile tested. Yu Zhao, assuming you were able
 to trigger the original problem could you test with the below patch
 please?
 ---
+>From c812fe4e519914aa37f092d3a0321038fadcdde7 Mon Sep 17 00:00:00 2001
+From: Michal Hocko <mhocko@suse.com>
+Date: Fri, 2 Dec 2016 16:06:56 +0100
+Subject: [PATCH] hotplug: make register and unregister notifier API symmetric
+
+Yu Zhao has noticed that __unregister_cpu_notifier only unregisters its
+notifiers when HOTPLUG_CPU=y while the registration might succeed even
+when HOTPLUG_CPU=n if MODULE is enabled. This means that e.g. zswap
+might keep a stale notifier on the list on the manual clean up during
+the pool tear down and thus corrupt the list. Fix this issue by making
+unregister APIs symmetric to the register so there are no surprises.
+
+Fixes: 47e627bc8c9a ("[PATCH] hotplug: Allow modules to use the cpu hotplug notifiers even if !CONFIG_HOTPLUG_CPU")
+Cc: stable # zswap needs it 4.3+
+Reported-by: Yu Zhao <yuzhao@google.com>
+Signed-off-by: Michal Hocko <mhocko@suse.com>
+---
+ include/linux/cpu.h | 15 ++++-----------
+ 1 file changed, 4 insertions(+), 11 deletions(-)
+
+diff --git a/include/linux/cpu.h b/include/linux/cpu.h
+index 797d9c8e9a1b..c8938eb21e34 100644
+--- a/include/linux/cpu.h
++++ b/include/linux/cpu.h
+@@ -105,22 +105,16 @@ extern bool cpuhp_tasks_frozen;
+ 		{ .notifier_call = fn, .priority = pri };	\
+ 	__register_cpu_notifier(&fn##_nb);			\
+ }
+-#else /* #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */
+-#define cpu_notifier(fn, pri)	do { (void)(fn); } while (0)
+-#define __cpu_notifier(fn, pri)	do { (void)(fn); } while (0)
+-#endif /* #else #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */
+ 
+-#ifdef CONFIG_HOTPLUG_CPU
+ extern int register_cpu_notifier(struct notifier_block *nb);
+ extern int __register_cpu_notifier(struct notifier_block *nb);
+ extern void unregister_cpu_notifier(struct notifier_block *nb);
+ extern void __unregister_cpu_notifier(struct notifier_block *nb);
+-#else
+ 
+-#ifndef MODULE
+-extern int register_cpu_notifier(struct notifier_block *nb);
+-extern int __register_cpu_notifier(struct notifier_block *nb);
+-#else
++#else /* #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */
++#define cpu_notifier(fn, pri)	do { (void)(fn); } while (0)
++#define __cpu_notifier(fn, pri)	do { (void)(fn); } while (0)
++
+ static inline int register_cpu_notifier(struct notifier_block *nb)
+ {
+ 	return 0;
+@@ -130,7 +124,6 @@ static inline int __register_cpu_notifier(struct notifier_block *nb)
+ {
+ 	return 0;
+ }
+-#endif
+ 
+ static inline void unregister_cpu_notifier(struct notifier_block *nb)
+ {
+-- 
+2.10.2
+
+-- 
+Michal Hocko
+SUSE Labs
diff --git a/a/content_digest b/N1/content_digest
index 0971958..2be6df7 100644
--- a/a/content_digest
+++ b/N1/content_digest
@@ -75,6 +75,71 @@
  "OK, this is still only compile tested. Yu Zhao, assuming you were able\n"
  "to trigger the original problem could you test with the below patch\n"
  "please?\n"
- ---
+ "---\n"
+ ">From c812fe4e519914aa37f092d3a0321038fadcdde7 Mon Sep 17 00:00:00 2001\n"
+ "From: Michal Hocko <mhocko@suse.com>\n"
+ "Date: Fri, 2 Dec 2016 16:06:56 +0100\n"
+ "Subject: [PATCH] hotplug: make register and unregister notifier API symmetric\n"
+ "\n"
+ "Yu Zhao has noticed that __unregister_cpu_notifier only unregisters its\n"
+ "notifiers when HOTPLUG_CPU=y while the registration might succeed even\n"
+ "when HOTPLUG_CPU=n if MODULE is enabled. This means that e.g. zswap\n"
+ "might keep a stale notifier on the list on the manual clean up during\n"
+ "the pool tear down and thus corrupt the list. Fix this issue by making\n"
+ "unregister APIs symmetric to the register so there are no surprises.\n"
+ "\n"
+ "Fixes: 47e627bc8c9a (\"[PATCH] hotplug: Allow modules to use the cpu hotplug notifiers even if !CONFIG_HOTPLUG_CPU\")\n"
+ "Cc: stable # zswap needs it 4.3+\n"
+ "Reported-by: Yu Zhao <yuzhao@google.com>\n"
+ "Signed-off-by: Michal Hocko <mhocko@suse.com>\n"
+ "---\n"
+ " include/linux/cpu.h | 15 ++++-----------\n"
+ " 1 file changed, 4 insertions(+), 11 deletions(-)\n"
+ "\n"
+ "diff --git a/include/linux/cpu.h b/include/linux/cpu.h\n"
+ "index 797d9c8e9a1b..c8938eb21e34 100644\n"
+ "--- a/include/linux/cpu.h\n"
+ "+++ b/include/linux/cpu.h\n"
+ "@@ -105,22 +105,16 @@ extern bool cpuhp_tasks_frozen;\n"
+ " \t\t{ .notifier_call = fn, .priority = pri };\t\\\n"
+ " \t__register_cpu_notifier(&fn##_nb);\t\t\t\\\n"
+ " }\n"
+ "-#else /* #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */\n"
+ "-#define cpu_notifier(fn, pri)\tdo { (void)(fn); } while (0)\n"
+ "-#define __cpu_notifier(fn, pri)\tdo { (void)(fn); } while (0)\n"
+ "-#endif /* #else #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */\n"
+ " \n"
+ "-#ifdef CONFIG_HOTPLUG_CPU\n"
+ " extern int register_cpu_notifier(struct notifier_block *nb);\n"
+ " extern int __register_cpu_notifier(struct notifier_block *nb);\n"
+ " extern void unregister_cpu_notifier(struct notifier_block *nb);\n"
+ " extern void __unregister_cpu_notifier(struct notifier_block *nb);\n"
+ "-#else\n"
+ " \n"
+ "-#ifndef MODULE\n"
+ "-extern int register_cpu_notifier(struct notifier_block *nb);\n"
+ "-extern int __register_cpu_notifier(struct notifier_block *nb);\n"
+ "-#else\n"
+ "+#else /* #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */\n"
+ "+#define cpu_notifier(fn, pri)\tdo { (void)(fn); } while (0)\n"
+ "+#define __cpu_notifier(fn, pri)\tdo { (void)(fn); } while (0)\n"
+ "+\n"
+ " static inline int register_cpu_notifier(struct notifier_block *nb)\n"
+ " {\n"
+ " \treturn 0;\n"
+ "@@ -130,7 +124,6 @@ static inline int __register_cpu_notifier(struct notifier_block *nb)\n"
+ " {\n"
+ " \treturn 0;\n"
+ " }\n"
+ "-#endif\n"
+ " \n"
+ " static inline void unregister_cpu_notifier(struct notifier_block *nb)\n"
+ " {\n"
+ "-- \n"
+ "2.10.2\n"
+ "\n"
+ "-- \n"
+ "Michal Hocko\n"
+ SUSE Labs
 
-8b47ccbf56c2b0f63cb7c6f0e171d722e38ebad19868678f518c443f8906b331
+6cf9c912ac16cda1da752d849e719a50107ba68eb7b7d8e40fe777e56fef2ea5

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.