aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/kernel.h1
-rw-r--r--kernel/extable.c2
-rw-r--r--kernel/module.c12
3 files changed, 8 insertions, 7 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index e1bd0842f6a1..f4fc576ed4c4 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -124,6 +124,7 @@ extern int get_option(char **str, int *pint);
124extern char *get_options(const char *str, int nints, int *ints); 124extern char *get_options(const char *str, int nints, int *ints);
125extern unsigned long long memparse(char *ptr, char **retptr); 125extern unsigned long long memparse(char *ptr, char **retptr);
126 126
127extern int core_kernel_text(unsigned long addr);
127extern int __kernel_text_address(unsigned long addr); 128extern int __kernel_text_address(unsigned long addr);
128extern int kernel_text_address(unsigned long addr); 129extern int kernel_text_address(unsigned long addr);
129extern int session_of_pgrp(int pgrp); 130extern int session_of_pgrp(int pgrp);
diff --git a/kernel/extable.c b/kernel/extable.c
index 7501b531ceed..7fe262855317 100644
--- a/kernel/extable.c
+++ b/kernel/extable.c
@@ -40,7 +40,7 @@ const struct exception_table_entry *search_exception_tables(unsigned long addr)
40 return e; 40 return e;
41} 41}
42 42
43static int core_kernel_text(unsigned long addr) 43int core_kernel_text(unsigned long addr)
44{ 44{
45 if (addr >= (unsigned long)_stext && 45 if (addr >= (unsigned long)_stext &&
46 addr <= (unsigned long)_etext) 46 addr <= (unsigned long)_etext)
diff --git a/kernel/module.c b/kernel/module.c
index d24deb0dbbc9..bbe04862e1b0 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -705,14 +705,14 @@ EXPORT_SYMBOL(__symbol_put);
705 705
706void symbol_put_addr(void *addr) 706void symbol_put_addr(void *addr)
707{ 707{
708 unsigned long flags; 708 struct module *modaddr;
709 709
710 spin_lock_irqsave(&modlist_lock, flags); 710 if (core_kernel_text((unsigned long)addr))
711 if (!kernel_text_address((unsigned long)addr)) 711 return;
712 BUG();
713 712
714 module_put(module_text_address((unsigned long)addr)); 713 if (!(modaddr = module_text_address((unsigned long)addr)))
715 spin_unlock_irqrestore(&modlist_lock, flags); 714 BUG();
715 module_put(modaddr);
716} 716}
717EXPORT_SYMBOL_GPL(symbol_put_addr); 717EXPORT_SYMBOL_GPL(symbol_put_addr);
718 718