aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/kmod.h18
-rw-r--r--kernel/kmod.c8
-rw-r--r--security/keys/request_key.c2
3 files changed, 10 insertions, 18 deletions
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index 1b5985855ffc..9efeae679106 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -48,12 +48,9 @@ static inline int request_module_nowait(const char *name, ...) { return -ENOSYS;
48struct cred; 48struct cred;
49struct file; 49struct file;
50 50
51enum umh_wait { 51#define UMH_NO_WAIT 0 /* don't wait at all */
52 UMH_NO_WAIT = -1, /* don't wait at all */ 52#define UMH_WAIT_EXEC 1 /* wait for the exec, but not the process */
53 UMH_WAIT_EXEC = 0, /* wait for the exec, but not the process */ 53#define UMH_WAIT_PROC 2 /* wait for the process to complete */
54 UMH_WAIT_PROC = 1, /* wait for the process to complete */
55};
56
57#define UMH_KILLABLE 4 /* wait for EXEC/PROC killable */ 54#define UMH_KILLABLE 4 /* wait for EXEC/PROC killable */
58 55
59struct subprocess_info { 56struct subprocess_info {
@@ -62,7 +59,7 @@ struct subprocess_info {
62 char *path; 59 char *path;
63 char **argv; 60 char **argv;
64 char **envp; 61 char **envp;
65 enum umh_wait wait; 62 int wait;
66 int retval; 63 int retval;
67 int (*init)(struct subprocess_info *info, struct cred *new); 64 int (*init)(struct subprocess_info *info, struct cred *new);
68 void (*cleanup)(struct subprocess_info *info); 65 void (*cleanup)(struct subprocess_info *info);
@@ -80,15 +77,14 @@ void call_usermodehelper_setfns(struct subprocess_info *info,
80 void *data); 77 void *data);
81 78
82/* Actually execute the sub-process */ 79/* Actually execute the sub-process */
83int call_usermodehelper_exec(struct subprocess_info *info, enum umh_wait wait); 80int call_usermodehelper_exec(struct subprocess_info *info, int wait);
84 81
85/* Free the subprocess_info. This is only needed if you're not going 82/* Free the subprocess_info. This is only needed if you're not going
86 to call call_usermodehelper_exec */ 83 to call call_usermodehelper_exec */
87void call_usermodehelper_freeinfo(struct subprocess_info *info); 84void call_usermodehelper_freeinfo(struct subprocess_info *info);
88 85
89static inline int 86static inline int
90call_usermodehelper_fns(char *path, char **argv, char **envp, 87call_usermodehelper_fns(char *path, char **argv, char **envp, int wait,
91 enum umh_wait wait,
92 int (*init)(struct subprocess_info *info, struct cred *new), 88 int (*init)(struct subprocess_info *info, struct cred *new),
93 void (*cleanup)(struct subprocess_info *), void *data) 89 void (*cleanup)(struct subprocess_info *), void *data)
94{ 90{
@@ -106,7 +102,7 @@ call_usermodehelper_fns(char *path, char **argv, char **envp,
106} 102}
107 103
108static inline int 104static inline int
109call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait) 105call_usermodehelper(char *path, char **argv, char **envp, int wait)
110{ 106{
111 return call_usermodehelper_fns(path, argv, envp, wait, 107 return call_usermodehelper_fns(path, argv, envp, wait,
112 NULL, NULL, NULL); 108 NULL, NULL, NULL);
diff --git a/kernel/kmod.c b/kernel/kmod.c
index f92f917c450c..8341de91613f 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -257,12 +257,9 @@ static void __call_usermodehelper(struct work_struct *work)
257{ 257{
258 struct subprocess_info *sub_info = 258 struct subprocess_info *sub_info =
259 container_of(work, struct subprocess_info, work); 259 container_of(work, struct subprocess_info, work);
260 enum umh_wait wait = sub_info->wait; 260 int wait = sub_info->wait & ~UMH_KILLABLE;
261 pid_t pid; 261 pid_t pid;
262 262
263 if (wait != UMH_NO_WAIT)
264 wait &= ~UMH_KILLABLE;
265
266 /* CLONE_VFORK: wait until the usermode helper has execve'd 263 /* CLONE_VFORK: wait until the usermode helper has execve'd
267 * successfully We need the data structures to stay around 264 * successfully We need the data structures to stay around
268 * until that is done. */ 265 * until that is done. */
@@ -451,8 +448,7 @@ EXPORT_SYMBOL(call_usermodehelper_setfns);
451 * asynchronously if wait is not set, and runs as a child of keventd. 448 * asynchronously if wait is not set, and runs as a child of keventd.
452 * (ie. it runs with full root capabilities). 449 * (ie. it runs with full root capabilities).
453 */ 450 */
454int call_usermodehelper_exec(struct subprocess_info *sub_info, 451int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait)
455 enum umh_wait wait)
456{ 452{
457 DECLARE_COMPLETION_ONSTACK(done); 453 DECLARE_COMPLETION_ONSTACK(done);
458 int retval = 0; 454 int retval = 0;
diff --git a/security/keys/request_key.c b/security/keys/request_key.c
index 82465328c39b..cc3790315d2f 100644
--- a/security/keys/request_key.c
+++ b/security/keys/request_key.c
@@ -91,7 +91,7 @@ static void umh_keys_cleanup(struct subprocess_info *info)
91 * Call a usermode helper with a specific session keyring. 91 * Call a usermode helper with a specific session keyring.
92 */ 92 */
93static int call_usermodehelper_keys(char *path, char **argv, char **envp, 93static int call_usermodehelper_keys(char *path, char **argv, char **envp,
94 struct key *session_keyring, enum umh_wait wait) 94 struct key *session_keyring, int wait)
95{ 95{
96 gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL; 96 gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL;
97 struct subprocess_info *info = 97 struct subprocess_info *info =