diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2007-02-02 10:39:12 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-02-16 18:19:15 -0500 |
commit | c353c3fb0700a3c17ea2b0237710a184232ccd7f (patch) | |
tree | 7b5fd590bd9b0a08bee8425ad074e993629683d1 /kernel/module.c | |
parent | 89790fd789e024b23eb1fbccedd84a2015441ce0 (diff) |
Driver core: let request_module() send a /sys/modules/kmod/-uevent
On recent systems, calls to /sbin/modprobe are handled by udev depending
on the kind of device the kernel has discovered. This patch creates an
uevent for the kernels internal request_module(), to let udev take control
over the request, instead of forking the binary directly by the kernel.
The direct execution of /sbin/modprobe can be disabled by setting:
/sys/module/kmod/mod_request_helper (/proc/sys/kernel/modprobe)
to an empty string, the same way /proc/sys/kernel/hotplug is disabled on an
udev system.
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'kernel/module.c')
-rw-r--r-- | kernel/module.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/kernel/module.c b/kernel/module.c index 8a94e054230c..225501f620ff 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -653,20 +653,11 @@ static void wait_for_zero_refcount(struct module *mod) | |||
653 | mutex_lock(&module_mutex); | 653 | mutex_lock(&module_mutex); |
654 | } | 654 | } |
655 | 655 | ||
656 | asmlinkage long | 656 | int delete_module(const char *name, unsigned int flags) |
657 | sys_delete_module(const char __user *name_user, unsigned int flags) | ||
658 | { | 657 | { |
659 | struct module *mod; | 658 | struct module *mod; |
660 | char name[MODULE_NAME_LEN]; | ||
661 | int ret, forced = 0; | 659 | int ret, forced = 0; |
662 | 660 | ||
663 | if (!capable(CAP_SYS_MODULE)) | ||
664 | return -EPERM; | ||
665 | |||
666 | if (strncpy_from_user(name, name_user, MODULE_NAME_LEN-1) < 0) | ||
667 | return -EFAULT; | ||
668 | name[MODULE_NAME_LEN-1] = '\0'; | ||
669 | |||
670 | if (mutex_lock_interruptible(&module_mutex) != 0) | 661 | if (mutex_lock_interruptible(&module_mutex) != 0) |
671 | return -EINTR; | 662 | return -EINTR; |
672 | 663 | ||
@@ -727,6 +718,21 @@ sys_delete_module(const char __user *name_user, unsigned int flags) | |||
727 | return ret; | 718 | return ret; |
728 | } | 719 | } |
729 | 720 | ||
721 | asmlinkage long | ||
722 | sys_delete_module(const char __user *name_user, unsigned int flags) | ||
723 | { | ||
724 | char name[MODULE_NAME_LEN]; | ||
725 | |||
726 | if (!capable(CAP_SYS_MODULE)) | ||
727 | return -EPERM; | ||
728 | |||
729 | if (strncpy_from_user(name, name_user, MODULE_NAME_LEN-1) < 0) | ||
730 | return -EFAULT; | ||
731 | name[MODULE_NAME_LEN-1] = '\0'; | ||
732 | |||
733 | return delete_module(name, flags); | ||
734 | } | ||
735 | |||
730 | static void print_unload_info(struct seq_file *m, struct module *mod) | 736 | static void print_unload_info(struct seq_file *m, struct module *mod) |
731 | { | 737 | { |
732 | struct module_use *use; | 738 | struct module_use *use; |