From: Lucas De Marchi Date: Wed, 20 Mar 2013 04:08:29 +0000 (+1100) Subject: usermodehelper: split remaining calls to call_usermodehelper_fns() X-Git-Tag: next-20130321~2^2~104 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=2ecbe001e3d011427521a5009e7c05bfc2e98da2;p=karo-tx-linux.git 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 Cc: Oleg Nesterov Cc: David Howells Cc: James Morris Cc: Al Viro Cc: Tejun Heo Cc: "Rafael J. Wysocki" Signed-off-by: Andrew Morton --- diff --git a/fs/coredump.c b/fs/coredump.c index 7dfb3b062e24..d52f6bd5ad8e 100644 --- a/fs/coredump.c +++ b/fs/coredump.c @@ -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"); @@ -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", diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c index a32ec1ce882b..3e0878e8a80d 100644 --- a/init/do_mounts_initrd.c +++ b/init/do_mounts_initrd.c @@ -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; @@ -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;