From 6e67e57a42c63b9d1f7edb3ca2fd89868a72da21 Mon Sep 17 00:00:00 2001 From: Jan Stancek Date: Fri, 21 Nov 2014 17:19:51 +0100 Subject: [PATCH] wait for outstanding shadow variables free requests in kpatch_exit Unload of kpatch module (and kpatch_shadow_hash table) before all shadow variables free requests are processed can lead to kernel crash. Add rcu_barrier() to kpatch_exit() to wait for all outstanding RCU callbacks to complete. Signed-off-by: Jan Stancek --- kmod/core/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kmod/core/core.c b/kmod/core/core.c index bd50d3d..7803e55 100644 --- a/kmod/core/core.c +++ b/kmod/core/core.c @@ -1084,6 +1084,8 @@ err_root_kobj: static void kpatch_exit(void) { + rcu_barrier(); + WARN_ON(kpatch_num_patched != 0); WARN_ON(unregister_module_notifier(&kpatch_module_nb)); kobject_put(kpatch_patches_kobj);