Commit 9d944ef32e83405a07376f112e9f02161d3e9731
Committed by
Linus Torvalds
1 parent
d0bd587a80
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
usermodehelper: kill umh_wait, renumber UMH_* constants
No functional changes. It is not sane to use UMH_KILLABLE with enum umh_wait, but obviously we do not want another argument in call_usermodehelper_* helpers. Kill this enum, use the plain int. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Tejun Heo <tj@kernel.org> Cc: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 3 changed files with 10 additions and 18 deletions Side-by-side Diff
include/linux/kmod.h
... | ... | @@ -48,12 +48,9 @@ |
48 | 48 | struct cred; |
49 | 49 | struct file; |
50 | 50 | |
51 | -enum umh_wait { | |
52 | - UMH_NO_WAIT = -1, /* don't wait at all */ | |
53 | - UMH_WAIT_EXEC = 0, /* wait for the exec, but not the process */ | |
54 | - UMH_WAIT_PROC = 1, /* wait for the process to complete */ | |
55 | -}; | |
56 | - | |
51 | +#define UMH_NO_WAIT 0 /* don't wait at all */ | |
52 | +#define UMH_WAIT_EXEC 1 /* wait for the exec, but not the process */ | |
53 | +#define UMH_WAIT_PROC 2 /* wait for the process to complete */ | |
57 | 54 | #define UMH_KILLABLE 4 /* wait for EXEC/PROC killable */ |
58 | 55 | |
59 | 56 | struct subprocess_info { |
... | ... | @@ -62,7 +59,7 @@ |
62 | 59 | char *path; |
63 | 60 | char **argv; |
64 | 61 | char **envp; |
65 | - enum umh_wait wait; | |
62 | + int wait; | |
66 | 63 | int retval; |
67 | 64 | int (*init)(struct subprocess_info *info, struct cred *new); |
68 | 65 | void (*cleanup)(struct subprocess_info *info); |
69 | 66 | |
... | ... | @@ -80,15 +77,14 @@ |
80 | 77 | void *data); |
81 | 78 | |
82 | 79 | /* Actually execute the sub-process */ |
83 | -int call_usermodehelper_exec(struct subprocess_info *info, enum umh_wait wait); | |
80 | +int call_usermodehelper_exec(struct subprocess_info *info, int wait); | |
84 | 81 | |
85 | 82 | /* Free the subprocess_info. This is only needed if you're not going |
86 | 83 | to call call_usermodehelper_exec */ |
87 | 84 | void call_usermodehelper_freeinfo(struct subprocess_info *info); |
88 | 85 | |
89 | 86 | static inline int |
90 | -call_usermodehelper_fns(char *path, char **argv, char **envp, | |
91 | - enum umh_wait wait, | |
87 | +call_usermodehelper_fns(char *path, char **argv, char **envp, int wait, | |
92 | 88 | int (*init)(struct subprocess_info *info, struct cred *new), |
93 | 89 | void (*cleanup)(struct subprocess_info *), void *data) |
94 | 90 | { |
... | ... | @@ -106,7 +102,7 @@ |
106 | 102 | } |
107 | 103 | |
108 | 104 | static inline int |
109 | -call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait) | |
105 | +call_usermodehelper(char *path, char **argv, char **envp, int wait) | |
110 | 106 | { |
111 | 107 | return call_usermodehelper_fns(path, argv, envp, wait, |
112 | 108 | NULL, NULL, NULL); |
kernel/kmod.c
... | ... | @@ -257,12 +257,9 @@ |
257 | 257 | { |
258 | 258 | struct subprocess_info *sub_info = |
259 | 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 | 261 | pid_t pid; |
262 | 262 | |
263 | - if (wait != UMH_NO_WAIT) | |
264 | - wait &= ~UMH_KILLABLE; | |
265 | - | |
266 | 263 | /* CLONE_VFORK: wait until the usermode helper has execve'd |
267 | 264 | * successfully We need the data structures to stay around |
268 | 265 | * until that is done. */ |
... | ... | @@ -451,8 +448,7 @@ |
451 | 448 | * asynchronously if wait is not set, and runs as a child of keventd. |
452 | 449 | * (ie. it runs with full root capabilities). |
453 | 450 | */ |
454 | -int call_usermodehelper_exec(struct subprocess_info *sub_info, | |
455 | - enum umh_wait wait) | |
451 | +int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait) | |
456 | 452 | { |
457 | 453 | DECLARE_COMPLETION_ONSTACK(done); |
458 | 454 | int retval = 0; |
security/keys/request_key.c
... | ... | @@ -91,7 +91,7 @@ |
91 | 91 | * Call a usermode helper with a specific session keyring. |
92 | 92 | */ |
93 | 93 | static 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 | 96 | gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL; |
97 | 97 | struct subprocess_info *info = |