diff options
| -rw-r--r-- | include/linux/export.h | 1 | ||||
| -rw-r--r-- | include/linux/module.h | 64 | ||||
| -rw-r--r-- | kernel/module.c | 6 | ||||
| -rw-r--r-- | kernel/params.c | 25 |
4 files changed, 44 insertions, 52 deletions
diff --git a/include/linux/export.h b/include/linux/export.h index 3f2793d51899..96e45ea463e7 100644 --- a/include/linux/export.h +++ b/include/linux/export.h | |||
| @@ -59,6 +59,7 @@ extern struct module __this_module; | |||
| 59 | static const char __kstrtab_##sym[] \ | 59 | static const char __kstrtab_##sym[] \ |
| 60 | __attribute__((section("__ksymtab_strings"), aligned(1))) \ | 60 | __attribute__((section("__ksymtab_strings"), aligned(1))) \ |
| 61 | = VMLINUX_SYMBOL_STR(sym); \ | 61 | = VMLINUX_SYMBOL_STR(sym); \ |
| 62 | extern const struct kernel_symbol __ksymtab_##sym; \ | ||
| 62 | __visible const struct kernel_symbol __ksymtab_##sym \ | 63 | __visible const struct kernel_symbol __ksymtab_##sym \ |
| 63 | __used \ | 64 | __used \ |
| 64 | __attribute__((section("___ksymtab" sec "+" #sym), unused)) \ | 65 | __attribute__((section("___ksymtab" sec "+" #sym), unused)) \ |
diff --git a/include/linux/module.h b/include/linux/module.h index 15cd6b1b211e..eaf60ff9ba94 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
| @@ -29,8 +29,7 @@ | |||
| 29 | 29 | ||
| 30 | #define MODULE_NAME_LEN MAX_PARAM_PREFIX_LEN | 30 | #define MODULE_NAME_LEN MAX_PARAM_PREFIX_LEN |
| 31 | 31 | ||
| 32 | struct modversion_info | 32 | struct modversion_info { |
| 33 | { | ||
| 34 | unsigned long crc; | 33 | unsigned long crc; |
| 35 | char name[MODULE_NAME_LEN]; | 34 | char name[MODULE_NAME_LEN]; |
| 36 | }; | 35 | }; |
| @@ -84,12 +83,12 @@ void sort_main_extable(void); | |||
| 84 | void trim_init_extable(struct module *m); | 83 | void trim_init_extable(struct module *m); |
| 85 | 84 | ||
| 86 | #ifdef MODULE | 85 | #ifdef MODULE |
| 87 | #define MODULE_GENERIC_TABLE(gtype,name) \ | 86 | #define MODULE_GENERIC_TABLE(gtype, name) \ |
| 88 | extern const struct gtype##_id __mod_##gtype##_table \ | 87 | extern const struct gtype##_id __mod_##gtype##_table \ |
| 89 | __attribute__ ((unused, alias(__stringify(name)))) | 88 | __attribute__ ((unused, alias(__stringify(name)))) |
| 90 | 89 | ||
| 91 | #else /* !MODULE */ | 90 | #else /* !MODULE */ |
| 92 | #define MODULE_GENERIC_TABLE(gtype,name) | 91 | #define MODULE_GENERIC_TABLE(gtype, name) |
| 93 | #endif | 92 | #endif |
| 94 | 93 | ||
| 95 | /* Generic info of form tag = "info" */ | 94 | /* Generic info of form tag = "info" */ |
| @@ -126,7 +125,7 @@ extern const struct gtype##_id __mod_##gtype##_table \ | |||
| 126 | * is a GPL combined work. | 125 | * is a GPL combined work. |
| 127 | * | 126 | * |
| 128 | * This exists for several reasons | 127 | * This exists for several reasons |
| 129 | * 1. So modinfo can show license info for users wanting to vet their setup | 128 | * 1. So modinfo can show license info for users wanting to vet their setup |
| 130 | * is free | 129 | * is free |
| 131 | * 2. So the community can ignore bug reports including proprietary modules | 130 | * 2. So the community can ignore bug reports including proprietary modules |
| 132 | * 3. So vendors can do likewise based on their own policies | 131 | * 3. So vendors can do likewise based on their own policies |
| @@ -138,27 +137,29 @@ extern const struct gtype##_id __mod_##gtype##_table \ | |||
| 138 | * authors use multiple MODULE_AUTHOR() statements/lines. | 137 | * authors use multiple MODULE_AUTHOR() statements/lines. |
| 139 | */ | 138 | */ |
| 140 | #define MODULE_AUTHOR(_author) MODULE_INFO(author, _author) | 139 | #define MODULE_AUTHOR(_author) MODULE_INFO(author, _author) |
| 141 | 140 | ||
| 142 | /* What your module does. */ | 141 | /* What your module does. */ |
| 143 | #define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description) | 142 | #define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description) |
| 144 | 143 | ||
| 145 | #define MODULE_DEVICE_TABLE(type,name) \ | 144 | #define MODULE_DEVICE_TABLE(type, name) \ |
| 146 | MODULE_GENERIC_TABLE(type##_device,name) | 145 | MODULE_GENERIC_TABLE(type##_device, name) |
| 147 | 146 | ||
| 148 | /* Version of form [<epoch>:]<version>[-<extra-version>]. | 147 | /* Version of form [<epoch>:]<version>[-<extra-version>]. |
| 149 | Or for CVS/RCS ID version, everything but the number is stripped. | 148 | * Or for CVS/RCS ID version, everything but the number is stripped. |
| 150 | <epoch>: A (small) unsigned integer which allows you to start versions | 149 | * <epoch>: A (small) unsigned integer which allows you to start versions |
| 151 | anew. If not mentioned, it's zero. eg. "2:1.0" is after | 150 | * anew. If not mentioned, it's zero. eg. "2:1.0" is after |
| 152 | "1:2.0". | 151 | * "1:2.0". |
| 153 | <version>: The <version> may contain only alphanumerics and the | 152 | |
| 154 | character `.'. Ordered by numeric sort for numeric parts, | 153 | * <version>: The <version> may contain only alphanumerics and the |
| 155 | ascii sort for ascii parts (as per RPM or DEB algorithm). | 154 | * character `.'. Ordered by numeric sort for numeric parts, |
| 156 | <extraversion>: Like <version>, but inserted for local | 155 | * ascii sort for ascii parts (as per RPM or DEB algorithm). |
| 157 | customizations, eg "rh3" or "rusty1". | 156 | |
| 158 | 157 | * <extraversion>: Like <version>, but inserted for local | |
| 159 | Using this automatically adds a checksum of the .c files and the | 158 | * customizations, eg "rh3" or "rusty1". |
| 160 | local headers in "srcversion". | 159 | |
| 161 | */ | 160 | * Using this automatically adds a checksum of the .c files and the |
| 161 | * local headers in "srcversion". | ||
| 162 | */ | ||
| 162 | 163 | ||
| 163 | #if defined(MODULE) || !defined(CONFIG_SYSFS) | 164 | #if defined(MODULE) || !defined(CONFIG_SYSFS) |
| 164 | #define MODULE_VERSION(_version) MODULE_INFO(version, _version) | 165 | #define MODULE_VERSION(_version) MODULE_INFO(version, _version) |
| @@ -226,8 +227,7 @@ struct module_ref { | |||
| 226 | unsigned long decs; | 227 | unsigned long decs; |
| 227 | } __attribute((aligned(2 * sizeof(unsigned long)))); | 228 | } __attribute((aligned(2 * sizeof(unsigned long)))); |
| 228 | 229 | ||
| 229 | struct module | 230 | struct module { |
| 230 | { | ||
| 231 | enum module_state state; | 231 | enum module_state state; |
| 232 | 232 | ||
| 233 | /* Member of list of modules */ | 233 | /* Member of list of modules */ |
| @@ -451,7 +451,7 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, | |||
| 451 | 451 | ||
| 452 | extern void __module_put_and_exit(struct module *mod, long code) | 452 | extern void __module_put_and_exit(struct module *mod, long code) |
| 453 | __attribute__((noreturn)); | 453 | __attribute__((noreturn)); |
| 454 | #define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code); | 454 | #define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code) |
| 455 | 455 | ||
| 456 | #ifdef CONFIG_MODULE_UNLOAD | 456 | #ifdef CONFIG_MODULE_UNLOAD |
| 457 | unsigned long module_refcount(struct module *mod); | 457 | unsigned long module_refcount(struct module *mod); |
| @@ -480,8 +480,8 @@ static inline void module_put(struct module *module) | |||
| 480 | static inline void __module_get(struct module *module) | 480 | static inline void __module_get(struct module *module) |
| 481 | { | 481 | { |
| 482 | } | 482 | } |
| 483 | #define symbol_put(x) do { } while(0) | 483 | #define symbol_put(x) do { } while (0) |
| 484 | #define symbol_put_addr(p) do { } while(0) | 484 | #define symbol_put_addr(p) do { } while (0) |
| 485 | 485 | ||
| 486 | #endif /* CONFIG_MODULE_UNLOAD */ | 486 | #endif /* CONFIG_MODULE_UNLOAD */ |
| 487 | int ref_module(struct module *a, struct module *b); | 487 | int ref_module(struct module *a, struct module *b); |
| @@ -507,8 +507,8 @@ int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size, unsigned | |||
| 507 | /* For extable.c to search modules' exception tables. */ | 507 | /* For extable.c to search modules' exception tables. */ |
| 508 | const struct exception_table_entry *search_module_extables(unsigned long addr); | 508 | const struct exception_table_entry *search_module_extables(unsigned long addr); |
| 509 | 509 | ||
| 510 | int register_module_notifier(struct notifier_block * nb); | 510 | int register_module_notifier(struct notifier_block *nb); |
| 511 | int unregister_module_notifier(struct notifier_block * nb); | 511 | int unregister_module_notifier(struct notifier_block *nb); |
| 512 | 512 | ||
| 513 | extern void print_modules(void); | 513 | extern void print_modules(void); |
| 514 | 514 | ||
| @@ -548,8 +548,8 @@ static inline bool is_module_text_address(unsigned long addr) | |||
| 548 | 548 | ||
| 549 | /* Get/put a kernel symbol (calls should be symmetric) */ | 549 | /* Get/put a kernel symbol (calls should be symmetric) */ |
| 550 | #define symbol_get(x) ({ extern typeof(x) x __attribute__((weak)); &(x); }) | 550 | #define symbol_get(x) ({ extern typeof(x) x __attribute__((weak)); &(x); }) |
| 551 | #define symbol_put(x) do { } while(0) | 551 | #define symbol_put(x) do { } while (0) |
| 552 | #define symbol_put_addr(x) do { } while(0) | 552 | #define symbol_put_addr(x) do { } while (0) |
| 553 | 553 | ||
| 554 | static inline void __module_get(struct module *module) | 554 | static inline void __module_get(struct module *module) |
| 555 | { | 555 | { |
| @@ -606,13 +606,13 @@ static inline int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, | |||
| 606 | return 0; | 606 | return 0; |
| 607 | } | 607 | } |
| 608 | 608 | ||
| 609 | static inline int register_module_notifier(struct notifier_block * nb) | 609 | static inline int register_module_notifier(struct notifier_block *nb) |
| 610 | { | 610 | { |
| 611 | /* no events will happen anyway, so this can always succeed */ | 611 | /* no events will happen anyway, so this can always succeed */ |
| 612 | return 0; | 612 | return 0; |
| 613 | } | 613 | } |
| 614 | 614 | ||
| 615 | static inline int unregister_module_notifier(struct notifier_block * nb) | 615 | static inline int unregister_module_notifier(struct notifier_block *nb) |
| 616 | { | 616 | { |
| 617 | return 0; | 617 | return 0; |
| 618 | } | 618 | } |
diff --git a/kernel/module.c b/kernel/module.c index f5a3b1e8ec51..d24fcf29cb64 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
| @@ -815,10 +815,8 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user, | |||
| 815 | return -EFAULT; | 815 | return -EFAULT; |
| 816 | name[MODULE_NAME_LEN-1] = '\0'; | 816 | name[MODULE_NAME_LEN-1] = '\0'; |
| 817 | 817 | ||
| 818 | if (!(flags & O_NONBLOCK)) { | 818 | if (!(flags & O_NONBLOCK)) |
| 819 | printk(KERN_WARNING | 819 | pr_warn("waiting module removal not supported: please upgrade\n"); |
| 820 | "waiting module removal not supported: please upgrade"); | ||
| 821 | } | ||
| 822 | 820 | ||
| 823 | if (mutex_lock_interruptible(&module_mutex) != 0) | 821 | if (mutex_lock_interruptible(&module_mutex) != 0) |
| 824 | return -EINTR; | 822 | return -EINTR; |
diff --git a/kernel/params.c b/kernel/params.c index c00d5b502aa4..b00142e7f3ba 100644 --- a/kernel/params.c +++ b/kernel/params.c | |||
| @@ -227,17 +227,10 @@ int parse_args(const char *doing, | |||
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | /* Lazy bastard, eh? */ | 229 | /* Lazy bastard, eh? */ |
| 230 | #define STANDARD_PARAM_DEF(name, type, format, tmptype, strtolfn) \ | 230 | #define STANDARD_PARAM_DEF(name, type, format, strtolfn) \ |
| 231 | int param_set_##name(const char *val, const struct kernel_param *kp) \ | 231 | int param_set_##name(const char *val, const struct kernel_param *kp) \ |
| 232 | { \ | 232 | { \ |
| 233 | tmptype l; \ | 233 | return strtolfn(val, 0, (type *)kp->arg); \ |
| 234 | int ret; \ | ||
| 235 | \ | ||
| 236 | ret = strtolfn(val, 0, &l); \ | ||
| 237 | if (ret < 0 || ((type)l != l)) \ | ||
| 238 | return ret < 0 ? ret : -EINVAL; \ | ||
| 239 | *((type *)kp->arg) = l; \ | ||
| 240 | return 0; \ | ||
| 241 | } \ | 234 | } \ |
| 242 | int param_get_##name(char *buffer, const struct kernel_param *kp) \ | 235 | int param_get_##name(char *buffer, const struct kernel_param *kp) \ |
| 243 | { \ | 236 | { \ |
| @@ -253,13 +246,13 @@ int parse_args(const char *doing, | |||
| 253 | EXPORT_SYMBOL(param_ops_##name) | 246 | EXPORT_SYMBOL(param_ops_##name) |
| 254 | 247 | ||
| 255 | 248 | ||
| 256 | STANDARD_PARAM_DEF(byte, unsigned char, "%hhu", unsigned long, kstrtoul); | 249 | STANDARD_PARAM_DEF(byte, unsigned char, "%hhu", kstrtou8); |
| 257 | STANDARD_PARAM_DEF(short, short, "%hi", long, kstrtol); | 250 | STANDARD_PARAM_DEF(short, short, "%hi", kstrtos16); |
| 258 | STANDARD_PARAM_DEF(ushort, unsigned short, "%hu", unsigned long, kstrtoul); | 251 | STANDARD_PARAM_DEF(ushort, unsigned short, "%hu", kstrtou16); |
| 259 | STANDARD_PARAM_DEF(int, int, "%i", long, kstrtol); | 252 | STANDARD_PARAM_DEF(int, int, "%i", kstrtoint); |
| 260 | STANDARD_PARAM_DEF(uint, unsigned int, "%u", unsigned long, kstrtoul); | 253 | STANDARD_PARAM_DEF(uint, unsigned int, "%u", kstrtouint); |
| 261 | STANDARD_PARAM_DEF(long, long, "%li", long, kstrtol); | 254 | STANDARD_PARAM_DEF(long, long, "%li", kstrtol); |
| 262 | STANDARD_PARAM_DEF(ulong, unsigned long, "%lu", unsigned long, kstrtoul); | 255 | STANDARD_PARAM_DEF(ulong, unsigned long, "%lu", kstrtoul); |
| 263 | 256 | ||
| 264 | int param_set_charp(const char *val, const struct kernel_param *kp) | 257 | int param_set_charp(const char *val, const struct kernel_param *kp) |
| 265 | { | 258 | { |
