summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-10-27 23:17:50 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2015-10-27 23:17:50 +0100
commit9e17f9070280bd58af9aead415544387a7a61427 (patch)
tree7422d00d873d2e1e9f78dc857c684ec4ea0eeb50 /kernel
parentMerge tag 'iommu-fixes-v4.3-rc7' of git://git.kernel.org/pub/scm/linux/kernel... (diff)
parentmodule: Fix locking in symbol_put_addr() (diff)
downloadlinux-9e17f9070280bd58af9aead415544387a7a61427.tar.xz
linux-9e17f9070280bd58af9aead415544387a7a61427.zip
Merge tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux
Pull module preemption fix from Rusty Russell: "Turns out we should have always been disabling preemption here; someone finally caught it thanks to Peter Z's additional checks" * tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux: module: Fix locking in symbol_put_addr()
Diffstat (limited to 'kernel')
-rw-r--r--kernel/module.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/kernel/module.c b/kernel/module.c
index b86b7bf1be38..8f051a106676 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1063,11 +1063,15 @@ void symbol_put_addr(void *addr)
if (core_kernel_text(a))
return;
- /* module_text_address is safe here: we're supposed to have reference
- * to module from symbol_get, so it can't go away. */
+ /*
+ * Even though we hold a reference on the module; we still need to
+ * disable preemption in order to safely traverse the data structure.
+ */
+ preempt_disable();
modaddr = __module_text_address(a);
BUG_ON(!modaddr);
module_put(modaddr);
+ preempt_enable();
}
EXPORT_SYMBOL_GPL(symbol_put_addr);