Commit 907ed1328d2a748f3d6028503d3e04c74ea62730

Authored by Lucas De Marchi
Committed by Linus Torvalds
1 parent fb96c475f6

usermodehelper: split remaining calls to call_usermodehelper_fns()

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 <lucas.demarchi@profusion.mobi>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: David Howells <dhowells@redhat.com>
Cc: James Morris <james.l.morris@oracle.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Tejun Heo <tj@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 2 changed files with 15 additions and 5 deletions Side-by-side Diff

... ... @@ -525,6 +525,7 @@
525 525 if (ispipe) {
526 526 int dump_count;
527 527 char **helper_argv;
  528 + struct subprocess_info *sub_info;
528 529  
529 530 if (ispipe < 0) {
530 531 printk(KERN_WARNING "format_corename failed\n");
... ... @@ -571,9 +572,14 @@
571 572 goto fail_dropcount;
572 573 }
573 574  
574   - retval = call_usermodehelper_fns(helper_argv[0], helper_argv,
575   - NULL, UMH_WAIT_EXEC, umh_pipe_setup,
576   - NULL, &cprm);
  575 + retval = -ENOMEM;
  576 + sub_info = call_usermodehelper_setup(helper_argv[0],
  577 + helper_argv, NULL, GFP_KERNEL,
  578 + umh_pipe_setup, NULL, &cprm);
  579 + if (sub_info)
  580 + retval = call_usermodehelper_exec(sub_info,
  581 + UMH_WAIT_EXEC);
  582 +
577 583 argv_free(helper_argv);
578 584 if (retval) {
579 585 printk(KERN_INFO "Core dump to %s pipe failed\n",
init/do_mounts_initrd.c
... ... @@ -50,6 +50,7 @@
50 50  
51 51 static void __init handle_initrd(void)
52 52 {
  53 + struct subprocess_info *info;
53 54 static char *argv[] = { "linuxrc", NULL, };
54 55 extern char *envp_init[];
55 56 int error;
... ... @@ -70,8 +71,11 @@
70 71 */
71 72 current->flags |= PF_FREEZER_SKIP;
72 73  
73   - call_usermodehelper_fns("/linuxrc", argv, envp_init, UMH_WAIT_PROC,
74   - init_linuxrc, NULL, NULL);
  74 + info = call_usermodehelper_setup("/linuxrc", argv, envp_init,
  75 + GFP_KERNEL, init_linuxrc, NULL, NULL);
  76 + if (!info)
  77 + return;
  78 + call_usermodehelper_exec(info, UMH_WAIT_PROC);
75 79  
76 80 current->flags &= ~PF_FREEZER_SKIP;
77 81