diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/kmod.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/kernel/kmod.c b/kernel/kmod.c index 685b246b13b0..56a29e812ff0 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c | |||
@@ -60,6 +60,21 @@ static DECLARE_RWSEM(umhelper_sem); | |||
60 | */ | 60 | */ |
61 | char modprobe_path[KMOD_PATH_LEN] = "/sbin/modprobe"; | 61 | char modprobe_path[KMOD_PATH_LEN] = "/sbin/modprobe"; |
62 | 62 | ||
63 | static int call_modprobe(char *module_name, int wait) | ||
64 | { | ||
65 | static char *envp[] = { | ||
66 | "HOME=/", | ||
67 | "TERM=linux", | ||
68 | "PATH=/sbin:/usr/sbin:/bin:/usr/bin", | ||
69 | NULL | ||
70 | }; | ||
71 | |||
72 | char *argv[] = { modprobe_path, "-q", "--", module_name, NULL }; | ||
73 | |||
74 | return call_usermodehelper_fns(modprobe_path, argv, envp, | ||
75 | wait, NULL, NULL, NULL); | ||
76 | } | ||
77 | |||
63 | /** | 78 | /** |
64 | * __request_module - try to load a kernel module | 79 | * __request_module - try to load a kernel module |
65 | * @wait: wait (or not) for the operation to complete | 80 | * @wait: wait (or not) for the operation to complete |
@@ -81,11 +96,6 @@ int __request_module(bool wait, const char *fmt, ...) | |||
81 | char module_name[MODULE_NAME_LEN]; | 96 | char module_name[MODULE_NAME_LEN]; |
82 | unsigned int max_modprobes; | 97 | unsigned int max_modprobes; |
83 | int ret; | 98 | int ret; |
84 | char *argv[] = { modprobe_path, "-q", "--", module_name, NULL }; | ||
85 | static char *envp[] = { "HOME=/", | ||
86 | "TERM=linux", | ||
87 | "PATH=/sbin:/usr/sbin:/bin:/usr/bin", | ||
88 | NULL }; | ||
89 | static atomic_t kmod_concurrent = ATOMIC_INIT(0); | 99 | static atomic_t kmod_concurrent = ATOMIC_INIT(0); |
90 | #define MAX_KMOD_CONCURRENT 50 /* Completely arbitrary value - KAO */ | 100 | #define MAX_KMOD_CONCURRENT 50 /* Completely arbitrary value - KAO */ |
91 | static int kmod_loop_msg; | 101 | static int kmod_loop_msg; |
@@ -128,9 +138,7 @@ int __request_module(bool wait, const char *fmt, ...) | |||
128 | 138 | ||
129 | trace_module_request(module_name, wait, _RET_IP_); | 139 | trace_module_request(module_name, wait, _RET_IP_); |
130 | 140 | ||
131 | ret = call_usermodehelper_fns(modprobe_path, argv, envp, | 141 | ret = call_modprobe(module_name, wait ? UMH_WAIT_PROC : UMH_WAIT_EXEC); |
132 | wait ? UMH_WAIT_PROC : UMH_WAIT_EXEC, | ||
133 | NULL, NULL, NULL); | ||
134 | 142 | ||
135 | atomic_dec(&kmod_concurrent); | 143 | atomic_dec(&kmod_concurrent); |
136 | return ret; | 144 | return ret; |