diff options
| -rw-r--r-- | Documentation/devices.txt | 2 | ||||
| -rw-r--r-- | arch/x86/kernel/microcode_core.c | 1 | ||||
| -rw-r--r-- | drivers/net/ppp_generic.c | 4 | ||||
| -rw-r--r-- | drivers/net/tun.c | 1 | ||||
| -rw-r--r-- | fs/autofs4/dev-ioctl.c | 5 | ||||
| -rw-r--r-- | fs/btrfs/super.c | 5 | ||||
| -rw-r--r-- | fs/fuse/dev.c | 1 | ||||
| -rw-r--r-- | include/linux/miscdevice.h | 2 | ||||
| -rw-r--r-- | kernel/module.c | 59 |
9 files changed, 39 insertions, 41 deletions
diff --git a/Documentation/devices.txt b/Documentation/devices.txt index 53d64d382343..1d83d124056c 100644 --- a/Documentation/devices.txt +++ b/Documentation/devices.txt | |||
| @@ -443,6 +443,8 @@ Your cooperation is appreciated. | |||
| 443 | 231 = /dev/snapshot System memory snapshot device | 443 | 231 = /dev/snapshot System memory snapshot device |
| 444 | 232 = /dev/kvm Kernel-based virtual machine (hardware virtualization extensions) | 444 | 232 = /dev/kvm Kernel-based virtual machine (hardware virtualization extensions) |
| 445 | 233 = /dev/kmview View-OS A process with a view | 445 | 233 = /dev/kmview View-OS A process with a view |
| 446 | 234 = /dev/btrfs-control Btrfs control device | ||
| 447 | 235 = /dev/autofs Autofs control device | ||
| 446 | 240-254 Reserved for local use | 448 | 240-254 Reserved for local use |
| 447 | 255 Reserved for MISC_DYNAMIC_MINOR | 449 | 255 Reserved for MISC_DYNAMIC_MINOR |
| 448 | 450 | ||
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c index 2cd8c544e41a..fa6551d36c10 100644 --- a/arch/x86/kernel/microcode_core.c +++ b/arch/x86/kernel/microcode_core.c | |||
| @@ -260,6 +260,7 @@ static void microcode_dev_exit(void) | |||
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | MODULE_ALIAS_MISCDEV(MICROCODE_MINOR); | 262 | MODULE_ALIAS_MISCDEV(MICROCODE_MINOR); |
| 263 | MODULE_ALIAS("devname:cpu/microcode"); | ||
| 263 | #else | 264 | #else |
| 264 | #define microcode_dev_init() 0 | 265 | #define microcode_dev_init() 0 |
| 265 | #define microcode_dev_exit() do { } while (0) | 266 | #define microcode_dev_exit() do { } while (0) |
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index 5441688daba7..c5f8eb102bf7 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
| @@ -2926,5 +2926,5 @@ EXPORT_SYMBOL(ppp_output_wakeup); | |||
| 2926 | EXPORT_SYMBOL(ppp_register_compressor); | 2926 | EXPORT_SYMBOL(ppp_register_compressor); |
| 2927 | EXPORT_SYMBOL(ppp_unregister_compressor); | 2927 | EXPORT_SYMBOL(ppp_unregister_compressor); |
| 2928 | MODULE_LICENSE("GPL"); | 2928 | MODULE_LICENSE("GPL"); |
| 2929 | MODULE_ALIAS_CHARDEV_MAJOR(PPP_MAJOR); | 2929 | MODULE_ALIAS_CHARDEV(PPP_MAJOR, 0); |
| 2930 | MODULE_ALIAS("/dev/ppp"); | 2930 | MODULE_ALIAS("devname:ppp"); |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 97b25533e5fb..005cad689578 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
| @@ -1649,3 +1649,4 @@ MODULE_DESCRIPTION(DRV_DESCRIPTION); | |||
| 1649 | MODULE_AUTHOR(DRV_COPYRIGHT); | 1649 | MODULE_AUTHOR(DRV_COPYRIGHT); |
| 1650 | MODULE_LICENSE("GPL"); | 1650 | MODULE_LICENSE("GPL"); |
| 1651 | MODULE_ALIAS_MISCDEV(TUN_MINOR); | 1651 | MODULE_ALIAS_MISCDEV(TUN_MINOR); |
| 1652 | MODULE_ALIAS("devname:net/tun"); | ||
diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c index d29b7f6df862..d832062869f6 100644 --- a/fs/autofs4/dev-ioctl.c +++ b/fs/autofs4/dev-ioctl.c | |||
| @@ -736,11 +736,14 @@ static const struct file_operations _dev_ioctl_fops = { | |||
| 736 | }; | 736 | }; |
| 737 | 737 | ||
| 738 | static struct miscdevice _autofs_dev_ioctl_misc = { | 738 | static struct miscdevice _autofs_dev_ioctl_misc = { |
| 739 | .minor = MISC_DYNAMIC_MINOR, | 739 | .minor = AUTOFS_MINOR, |
| 740 | .name = AUTOFS_DEVICE_NAME, | 740 | .name = AUTOFS_DEVICE_NAME, |
| 741 | .fops = &_dev_ioctl_fops | 741 | .fops = &_dev_ioctl_fops |
| 742 | }; | 742 | }; |
| 743 | 743 | ||
| 744 | MODULE_ALIAS_MISCDEV(AUTOFS_MINOR); | ||
| 745 | MODULE_ALIAS("devname:autofs"); | ||
| 746 | |||
| 744 | /* Register/deregister misc character device */ | 747 | /* Register/deregister misc character device */ |
| 745 | int autofs_dev_ioctl_init(void) | 748 | int autofs_dev_ioctl_init(void) |
| 746 | { | 749 | { |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 1866dff0538e..2909a03e5230 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
| @@ -832,11 +832,14 @@ static const struct file_operations btrfs_ctl_fops = { | |||
| 832 | }; | 832 | }; |
| 833 | 833 | ||
| 834 | static struct miscdevice btrfs_misc = { | 834 | static struct miscdevice btrfs_misc = { |
| 835 | .minor = MISC_DYNAMIC_MINOR, | 835 | .minor = BTRFS_MINOR, |
| 836 | .name = "btrfs-control", | 836 | .name = "btrfs-control", |
| 837 | .fops = &btrfs_ctl_fops | 837 | .fops = &btrfs_ctl_fops |
| 838 | }; | 838 | }; |
| 839 | 839 | ||
| 840 | MODULE_ALIAS_MISCDEV(BTRFS_MINOR); | ||
| 841 | MODULE_ALIAS("devname:btrfs-control"); | ||
| 842 | |||
| 840 | static int btrfs_interface_init(void) | 843 | static int btrfs_interface_init(void) |
| 841 | { | 844 | { |
| 842 | return misc_register(&btrfs_misc); | 845 | return misc_register(&btrfs_misc); |
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index eb7e9423691f..e53df5ebb2b8 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
| 19 | 19 | ||
| 20 | MODULE_ALIAS_MISCDEV(FUSE_MINOR); | 20 | MODULE_ALIAS_MISCDEV(FUSE_MINOR); |
| 21 | MODULE_ALIAS("devname:fuse"); | ||
| 21 | 22 | ||
| 22 | static struct kmem_cache *fuse_req_cachep; | 23 | static struct kmem_cache *fuse_req_cachep; |
| 23 | 24 | ||
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h index 8b5f7cc0fba6..b631c46cffd9 100644 --- a/include/linux/miscdevice.h +++ b/include/linux/miscdevice.h | |||
| @@ -31,6 +31,8 @@ | |||
| 31 | #define FUSE_MINOR 229 | 31 | #define FUSE_MINOR 229 |
| 32 | #define KVM_MINOR 232 | 32 | #define KVM_MINOR 232 |
| 33 | #define VHOST_NET_MINOR 233 | 33 | #define VHOST_NET_MINOR 233 |
| 34 | #define BTRFS_MINOR 234 | ||
| 35 | #define AUTOFS_MINOR 235 | ||
| 34 | #define MISC_DYNAMIC_MINOR 255 | 36 | #define MISC_DYNAMIC_MINOR 255 |
| 35 | 37 | ||
| 36 | struct device; | 38 | struct device; |
diff --git a/kernel/module.c b/kernel/module.c index 625985e70e9d..333fbcc96978 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
| @@ -563,26 +563,33 @@ int use_module(struct module *a, struct module *b) | |||
| 563 | struct module_use *use; | 563 | struct module_use *use; |
| 564 | int no_warn, err; | 564 | int no_warn, err; |
| 565 | 565 | ||
| 566 | if (b == NULL || already_uses(a, b)) | 566 | if (b == NULL || already_uses(a, b)) return 1; |
| 567 | return 0; | ||
| 568 | 567 | ||
| 569 | /* If we're interrupted or time out, we fail. */ | 568 | /* If we're interrupted or time out, we fail. */ |
| 570 | err = strong_try_module_get(b); | 569 | if (wait_event_interruptible_timeout( |
| 570 | module_wq, (err = strong_try_module_get(b)) != -EBUSY, | ||
| 571 | 30 * HZ) <= 0) { | ||
| 572 | printk("%s: gave up waiting for init of module %s.\n", | ||
| 573 | a->name, b->name); | ||
| 574 | return 0; | ||
| 575 | } | ||
| 576 | |||
| 577 | /* If strong_try_module_get() returned a different error, we fail. */ | ||
| 571 | if (err) | 578 | if (err) |
| 572 | return err; | 579 | return 0; |
| 573 | 580 | ||
| 574 | DEBUGP("Allocating new usage for %s.\n", a->name); | 581 | DEBUGP("Allocating new usage for %s.\n", a->name); |
| 575 | use = kmalloc(sizeof(*use), GFP_ATOMIC); | 582 | use = kmalloc(sizeof(*use), GFP_ATOMIC); |
| 576 | if (!use) { | 583 | if (!use) { |
| 577 | printk("%s: out of memory loading\n", a->name); | 584 | printk("%s: out of memory loading\n", a->name); |
| 578 | module_put(b); | 585 | module_put(b); |
| 579 | return -ENOMEM; | 586 | return 0; |
| 580 | } | 587 | } |
| 581 | 588 | ||
| 582 | use->module_which_uses = a; | 589 | use->module_which_uses = a; |
| 583 | list_add(&use->list, &b->modules_which_use_me); | 590 | list_add(&use->list, &b->modules_which_use_me); |
| 584 | no_warn = sysfs_create_link(b->holders_dir, &a->mkobj.kobj, a->name); | 591 | no_warn = sysfs_create_link(b->holders_dir, &a->mkobj.kobj, a->name); |
| 585 | return 0; | 592 | return 1; |
| 586 | } | 593 | } |
| 587 | EXPORT_SYMBOL_GPL(use_module); | 594 | EXPORT_SYMBOL_GPL(use_module); |
| 588 | 595 | ||
| @@ -875,7 +882,7 @@ static inline void module_unload_free(struct module *mod) | |||
| 875 | 882 | ||
| 876 | int use_module(struct module *a, struct module *b) | 883 | int use_module(struct module *a, struct module *b) |
| 877 | { | 884 | { |
| 878 | return strong_try_module_get(b); | 885 | return strong_try_module_get(b) == 0; |
| 879 | } | 886 | } |
| 880 | EXPORT_SYMBOL_GPL(use_module); | 887 | EXPORT_SYMBOL_GPL(use_module); |
| 881 | 888 | ||
| @@ -1046,39 +1053,17 @@ static const struct kernel_symbol *resolve_symbol(Elf_Shdr *sechdrs, | |||
| 1046 | struct module *owner; | 1053 | struct module *owner; |
| 1047 | const struct kernel_symbol *sym; | 1054 | const struct kernel_symbol *sym; |
| 1048 | const unsigned long *crc; | 1055 | const unsigned long *crc; |
| 1049 | DEFINE_WAIT(wait); | ||
| 1050 | int err; | ||
| 1051 | long timeleft = 30 * HZ; | ||
| 1052 | 1056 | ||
| 1053 | again: | ||
| 1054 | sym = find_symbol(name, &owner, &crc, | 1057 | sym = find_symbol(name, &owner, &crc, |
| 1055 | !(mod->taints & (1 << TAINT_PROPRIETARY_MODULE)), true); | 1058 | !(mod->taints & (1 << TAINT_PROPRIETARY_MODULE)), true); |
| 1056 | if (!sym) | 1059 | /* use_module can fail due to OOM, |
| 1057 | return NULL; | 1060 | or module initialization or unloading */ |
| 1058 | 1061 | if (sym) { | |
| 1059 | if (!check_version(sechdrs, versindex, name, mod, crc, owner)) | 1062 | if (!check_version(sechdrs, versindex, name, mod, crc, owner) |
| 1060 | return NULL; | 1063 | || !use_module(mod, owner)) |
| 1061 | 1064 | sym = NULL; | |
| 1062 | prepare_to_wait(&module_wq, &wait, TASK_INTERRUPTIBLE); | 1065 | } |
| 1063 | err = use_module(mod, owner); | 1066 | return sym; |
| 1064 | if (likely(!err) || err != -EBUSY || signal_pending(current)) { | ||
| 1065 | finish_wait(&module_wq, &wait); | ||
| 1066 | return err ? NULL : sym; | ||
| 1067 | } | ||
| 1068 | |||
| 1069 | /* Module is still loading. Drop lock and wait. */ | ||
| 1070 | mutex_unlock(&module_mutex); | ||
| 1071 | timeleft = schedule_timeout(timeleft); | ||
| 1072 | mutex_lock(&module_mutex); | ||
| 1073 | finish_wait(&module_wq, &wait); | ||
| 1074 | |||
| 1075 | /* Module might be gone entirely, or replaced. Re-lookup. */ | ||
| 1076 | if (timeleft) | ||
| 1077 | goto again; | ||
| 1078 | |||
| 1079 | printk(KERN_WARNING "%s: gave up waiting for init of module %s.\n", | ||
| 1080 | mod->name, owner->name); | ||
| 1081 | return NULL; | ||
| 1082 | } | 1067 | } |
| 1083 | 1068 | ||
| 1084 | /* | 1069 | /* |
