Skip to content

Commit

Permalink
usermodehelper: split remaining calls to call_usermodehelper_fns()
Browse files Browse the repository at this point in the history
These are the only users of call_usermodehelper_fns().  This function
suffers from not being able to determine if the cleanup is called.  Even
if in this places the cleanup pointer is NULL, convert them to use the
separate call_usermodehelper_setup() + call_usermodehelper_exec()
functions so we can remove the _fns variant.

Signed-off-by: Lucas De Marchi <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: David Howells <[email protected]>
Cc: James Morris <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Lucas De Marchi authored and torvalds committed May 1, 2013
1 parent fb96c47 commit 907ed13
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
12 changes: 9 additions & 3 deletions fs/coredump.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ void do_coredump(siginfo_t *siginfo)
if (ispipe) {
int dump_count;
char **helper_argv;
struct subprocess_info *sub_info;

if (ispipe < 0) {
printk(KERN_WARNING "format_corename failed\n");
Expand Down Expand Up @@ -571,9 +572,14 @@ void do_coredump(siginfo_t *siginfo)
goto fail_dropcount;
}

retval = call_usermodehelper_fns(helper_argv[0], helper_argv,
NULL, UMH_WAIT_EXEC, umh_pipe_setup,
NULL, &cprm);
retval = -ENOMEM;
sub_info = call_usermodehelper_setup(helper_argv[0],
helper_argv, NULL, GFP_KERNEL,
umh_pipe_setup, NULL, &cprm);
if (sub_info)
retval = call_usermodehelper_exec(sub_info,
UMH_WAIT_EXEC);

argv_free(helper_argv);
if (retval) {
printk(KERN_INFO "Core dump to %s pipe failed\n",
Expand Down
8 changes: 6 additions & 2 deletions init/do_mounts_initrd.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ static int init_linuxrc(struct subprocess_info *info, struct cred *new)

static void __init handle_initrd(void)
{
struct subprocess_info *info;
static char *argv[] = { "linuxrc", NULL, };
extern char *envp_init[];
int error;
Expand All @@ -70,8 +71,11 @@ static void __init handle_initrd(void)
*/
current->flags |= PF_FREEZER_SKIP;

call_usermodehelper_fns("/linuxrc", argv, envp_init, UMH_WAIT_PROC,
init_linuxrc, NULL, NULL);
info = call_usermodehelper_setup("/linuxrc", argv, envp_init,
GFP_KERNEL, init_linuxrc, NULL, NULL);
if (!info)
return;
call_usermodehelper_exec(info, UMH_WAIT_PROC);

current->flags &= ~PF_FREEZER_SKIP;

Expand Down

0 comments on commit 907ed13

Please sign in to comment.