diff options
Diffstat (limited to 'kernel/module.c')
-rw-r--r-- | kernel/module.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/kernel/module.c b/kernel/module.c index 1016b75b026a..333fbcc96978 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -59,8 +59,6 @@ | |||
59 | #define CREATE_TRACE_POINTS | 59 | #define CREATE_TRACE_POINTS |
60 | #include <trace/events/module.h> | 60 | #include <trace/events/module.h> |
61 | 61 | ||
62 | EXPORT_TRACEPOINT_SYMBOL(module_get); | ||
63 | |||
64 | #if 0 | 62 | #if 0 |
65 | #define DEBUGP printk | 63 | #define DEBUGP printk |
66 | #else | 64 | #else |
@@ -79,6 +77,10 @@ EXPORT_TRACEPOINT_SYMBOL(module_get); | |||
79 | DEFINE_MUTEX(module_mutex); | 77 | DEFINE_MUTEX(module_mutex); |
80 | EXPORT_SYMBOL_GPL(module_mutex); | 78 | EXPORT_SYMBOL_GPL(module_mutex); |
81 | static LIST_HEAD(modules); | 79 | static LIST_HEAD(modules); |
80 | #ifdef CONFIG_KGDB_KDB | ||
81 | struct list_head *kdb_modules = &modules; /* kdb needs the list of modules */ | ||
82 | #endif /* CONFIG_KGDB_KDB */ | ||
83 | |||
82 | 84 | ||
83 | /* Block module loading/unloading? */ | 85 | /* Block module loading/unloading? */ |
84 | int modules_disabled = 0; | 86 | int modules_disabled = 0; |
@@ -178,8 +180,6 @@ extern const struct kernel_symbol __start___ksymtab_gpl[]; | |||
178 | extern const struct kernel_symbol __stop___ksymtab_gpl[]; | 180 | extern const struct kernel_symbol __stop___ksymtab_gpl[]; |
179 | extern const struct kernel_symbol __start___ksymtab_gpl_future[]; | 181 | extern const struct kernel_symbol __start___ksymtab_gpl_future[]; |
180 | extern const struct kernel_symbol __stop___ksymtab_gpl_future[]; | 182 | extern const struct kernel_symbol __stop___ksymtab_gpl_future[]; |
181 | extern const struct kernel_symbol __start___ksymtab_gpl_future[]; | ||
182 | extern const struct kernel_symbol __stop___ksymtab_gpl_future[]; | ||
183 | extern const unsigned long __start___kcrctab[]; | 183 | extern const unsigned long __start___kcrctab[]; |
184 | extern const unsigned long __start___kcrctab_gpl[]; | 184 | extern const unsigned long __start___kcrctab_gpl[]; |
185 | extern const unsigned long __start___kcrctab_gpl_future[]; | 185 | extern const unsigned long __start___kcrctab_gpl_future[]; |
@@ -515,6 +515,9 @@ MODINFO_ATTR(srcversion); | |||
515 | static char last_unloaded_module[MODULE_NAME_LEN+1]; | 515 | static char last_unloaded_module[MODULE_NAME_LEN+1]; |
516 | 516 | ||
517 | #ifdef CONFIG_MODULE_UNLOAD | 517 | #ifdef CONFIG_MODULE_UNLOAD |
518 | |||
519 | EXPORT_TRACEPOINT_SYMBOL(module_get); | ||
520 | |||
518 | /* Init the unload section of the module. */ | 521 | /* Init the unload section of the module. */ |
519 | static void module_unload_init(struct module *mod) | 522 | static void module_unload_init(struct module *mod) |
520 | { | 523 | { |
@@ -723,16 +726,8 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user, | |||
723 | return -EFAULT; | 726 | return -EFAULT; |
724 | name[MODULE_NAME_LEN-1] = '\0'; | 727 | name[MODULE_NAME_LEN-1] = '\0'; |
725 | 728 | ||
726 | /* Create stop_machine threads since free_module relies on | 729 | if (mutex_lock_interruptible(&module_mutex) != 0) |
727 | * a non-failing stop_machine call. */ | 730 | return -EINTR; |
728 | ret = stop_machine_create(); | ||
729 | if (ret) | ||
730 | return ret; | ||
731 | |||
732 | if (mutex_lock_interruptible(&module_mutex) != 0) { | ||
733 | ret = -EINTR; | ||
734 | goto out_stop; | ||
735 | } | ||
736 | 731 | ||
737 | mod = find_module(name); | 732 | mod = find_module(name); |
738 | if (!mod) { | 733 | if (!mod) { |
@@ -792,8 +787,6 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user, | |||
792 | 787 | ||
793 | out: | 788 | out: |
794 | mutex_unlock(&module_mutex); | 789 | mutex_unlock(&module_mutex); |
795 | out_stop: | ||
796 | stop_machine_destroy(); | ||
797 | return ret; | 790 | return ret; |
798 | } | 791 | } |
799 | 792 | ||
@@ -867,8 +860,7 @@ void module_put(struct module *module) | |||
867 | smp_wmb(); /* see comment in module_refcount */ | 860 | smp_wmb(); /* see comment in module_refcount */ |
868 | __this_cpu_inc(module->refptr->decs); | 861 | __this_cpu_inc(module->refptr->decs); |
869 | 862 | ||
870 | trace_module_put(module, _RET_IP_, | 863 | trace_module_put(module, _RET_IP_); |
871 | __this_cpu_read(module->refptr->decs)); | ||
872 | /* Maybe they're waiting for us to drop reference? */ | 864 | /* Maybe they're waiting for us to drop reference? */ |
873 | if (unlikely(!module_is_live(module))) | 865 | if (unlikely(!module_is_live(module))) |
874 | wake_up_process(module->waiter); | 866 | wake_up_process(module->waiter); |
@@ -1192,7 +1184,7 @@ struct module_notes_attrs { | |||
1192 | struct bin_attribute attrs[0]; | 1184 | struct bin_attribute attrs[0]; |
1193 | }; | 1185 | }; |
1194 | 1186 | ||
1195 | static ssize_t module_notes_read(struct kobject *kobj, | 1187 | static ssize_t module_notes_read(struct file *filp, struct kobject *kobj, |
1196 | struct bin_attribute *bin_attr, | 1188 | struct bin_attribute *bin_attr, |
1197 | char *buf, loff_t pos, size_t count) | 1189 | char *buf, loff_t pos, size_t count) |
1198 | { | 1190 | { |