Commit 81ab6e7b authored by Boaz Harrosh's avatar Boaz Harrosh Committed by Linus Torvalds

kmod: convert two call sites to call_usermodehelper_fns()

Both kernel/sys.c && security/keys/request_key.c where inlining the exact
same code as call_usermodehelper_fns(); So simply convert these sites to
directly use call_usermodehelper_fns().
Signed-off-by: default avatarBoaz Harrosh <bharrosh@panasas.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ae3cef73
...@@ -2114,7 +2114,6 @@ int orderly_poweroff(bool force) ...@@ -2114,7 +2114,6 @@ int orderly_poweroff(bool force)
NULL NULL
}; };
int ret = -ENOMEM; int ret = -ENOMEM;
struct subprocess_info *info;
if (argv == NULL) { if (argv == NULL) {
printk(KERN_WARNING "%s failed to allocate memory for \"%s\"\n", printk(KERN_WARNING "%s failed to allocate memory for \"%s\"\n",
...@@ -2122,18 +2121,16 @@ int orderly_poweroff(bool force) ...@@ -2122,18 +2121,16 @@ int orderly_poweroff(bool force)
goto out; goto out;
} }
info = call_usermodehelper_setup(argv[0], argv, envp, GFP_ATOMIC); ret = call_usermodehelper_fns(argv[0], argv, envp, UMH_NO_WAIT,
if (info == NULL) { NULL, argv_cleanup, NULL);
argv_free(argv); out:
goto out; if (likely(!ret))
} return 0;
call_usermodehelper_setfns(info, NULL, argv_cleanup, NULL);
ret = call_usermodehelper_exec(info, UMH_NO_WAIT); if (ret == -ENOMEM)
argv_free(argv);
out: if (force) {
if (ret && force) {
printk(KERN_WARNING "Failed to start orderly shutdown: " printk(KERN_WARNING "Failed to start orderly shutdown: "
"forcing the issue\n"); "forcing the issue\n");
......
...@@ -93,16 +93,9 @@ static void umh_keys_cleanup(struct subprocess_info *info) ...@@ -93,16 +93,9 @@ static void umh_keys_cleanup(struct subprocess_info *info)
static int call_usermodehelper_keys(char *path, char **argv, char **envp, static int call_usermodehelper_keys(char *path, char **argv, char **envp,
struct key *session_keyring, int wait) struct key *session_keyring, int wait)
{ {
gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL; return call_usermodehelper_fns(path, argv, envp, wait,
struct subprocess_info *info = umh_keys_init, umh_keys_cleanup,
call_usermodehelper_setup(path, argv, envp, gfp_mask);
if (!info)
return -ENOMEM;
call_usermodehelper_setfns(info, umh_keys_init, umh_keys_cleanup,
key_get(session_keyring)); key_get(session_keyring));
return call_usermodehelper_exec(info, wait);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment