Skip to content

Commit 9d944ef

Browse files
oleg-nesterovtorvalds
authored andcommitted
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>
1 parent d0bd587 commit 9d944ef

3 files changed

Lines changed: 10 additions & 18 deletions

File tree

‎include/linux/kmod.h‎

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,9 @@ static inline int request_module_nowait(const char *name, ...) { return -ENOSYS;
4848
struct cred;
4949
struct file;
5050

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 */
5754
#define UMH_KILLABLE 4 /* wait for EXEC/PROC killable */
5855

5956
struct subprocess_info {
@@ -62,7 +59,7 @@ struct subprocess_info {
6259
char *path;
6360
char **argv;
6461
char **envp;
65-
enum umh_wait wait;
62+
int wait;
6663
int retval;
6764
int (*init)(struct subprocess_info *info, struct cred *new);
6865
void (*cleanup)(struct subprocess_info *info);
@@ -80,15 +77,14 @@ void call_usermodehelper_setfns(struct subprocess_info *info,
8077
void *data);
8178

8279
/* 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);
8481

8582
/* Free the subprocess_info. This is only needed if you're not going
8683
to call call_usermodehelper_exec */
8784
void call_usermodehelper_freeinfo(struct subprocess_info *info);
8885

8986
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,
9288
int (*init)(struct subprocess_info *info, struct cred *new),
9389
void (*cleanup)(struct subprocess_info *), void *data)
9490
{
@@ -106,7 +102,7 @@ call_usermodehelper_fns(char *path, char **argv, char **envp,
106102
}
107103

108104
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)
110106
{
111107
return call_usermodehelper_fns(path, argv, envp, wait,
112108
NULL, NULL, NULL);

‎kernel/kmod.c‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,9 @@ static void __call_usermodehelper(struct work_struct *work)
257257
{
258258
struct subprocess_info *sub_info =
259259
container_of(work, struct subprocess_info, work);
260-
enum umh_wait wait = sub_info->wait;
260+
int wait = sub_info->wait & ~UMH_KILLABLE;
261261
pid_t pid;
262262

263-
if (wait != UMH_NO_WAIT)
264-
wait &= ~UMH_KILLABLE;
265-
266263
/* CLONE_VFORK: wait until the usermode helper has execve'd
267264
* successfully We need the data structures to stay around
268265
* until that is done. */
@@ -451,8 +448,7 @@ EXPORT_SYMBOL(call_usermodehelper_setfns);
451448
* asynchronously if wait is not set, and runs as a child of keventd.
452449
* (ie. it runs with full root capabilities).
453450
*/
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)
456452
{
457453
DECLARE_COMPLETION_ONSTACK(done);
458454
int retval = 0;

‎security/keys/request_key.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static void umh_keys_cleanup(struct subprocess_info *info)
9191
* Call a usermode helper with a specific session keyring.
9292
*/
9393
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)
9595
{
9696
gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL;
9797
struct subprocess_info *info =

0 commit comments

Comments
 (0)