Skip to content

Commit 907ed13

Browse files
Lucas De Marchitorvalds
Lucas De Marchi
authored andcommitted
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 <[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]>
1 parent fb96c47 commit 907ed13

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

fs/coredump.c

+9-3
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ void do_coredump(siginfo_t *siginfo)
525525
if (ispipe) {
526526
int dump_count;
527527
char **helper_argv;
528+
struct subprocess_info *sub_info;
528529

529530
if (ispipe < 0) {
530531
printk(KERN_WARNING "format_corename failed\n");
@@ -571,9 +572,14 @@ void do_coredump(siginfo_t *siginfo)
571572
goto fail_dropcount;
572573
}
573574

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+
577583
argv_free(helper_argv);
578584
if (retval) {
579585
printk(KERN_INFO "Core dump to %s pipe failed\n",

init/do_mounts_initrd.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ static int init_linuxrc(struct subprocess_info *info, struct cred *new)
5050

5151
static void __init handle_initrd(void)
5252
{
53+
struct subprocess_info *info;
5354
static char *argv[] = { "linuxrc", NULL, };
5455
extern char *envp_init[];
5556
int error;
@@ -70,8 +71,11 @@ static void __init handle_initrd(void)
7071
*/
7172
current->flags |= PF_FREEZER_SKIP;
7273

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);
7579

7680
current->flags &= ~PF_FREEZER_SKIP;
7781

0 commit comments

Comments
 (0)