All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@profusion.mobi>
To: Oleg Nesterov <oleg@redhat.com>
Cc: lucas.de.marchi@gmail.com, David Howells <dhowells@redhat.com>,
	James Morris <james.l.morris@oracle.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	Lucas De Marchi <lucas.demarchi@profusion.mobi>
Subject: [PATCH v3 6/7] Split remaining calls to call_usermodehelper_fns()
Date: Mon, 11 Mar 2013 21:48:10 -0300	[thread overview]
Message-ID: <1363049291-946-6-git-send-email-lucas.demarchi@profusion.mobi> (raw)
In-Reply-To: <1363049291-946-1-git-send-email-lucas.demarchi@profusion.mobi>

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>
---

Changes from v2: simplify error handling as suggested by Oleg.

 fs/coredump.c           | 12 +++++++++---
 init/do_mounts_initrd.c |  8 ++++++--
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/fs/coredump.c b/fs/coredump.c
index 7dfb3b0..d52f6bd 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 a32ec1c..3e0878e 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;
 
-- 
1.8.1.5


  parent reply	other threads:[~2013-03-12  0:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-12  0:48 [PATCH v3 1/7] kernel/sys.c: Use the simpler call_usermodehelper() Lucas De Marchi
2013-03-12  0:48 ` [PATCH v3 2/7] usermodehelper: Export _exec() and _setup() functions Lucas De Marchi
2013-03-12 20:31   ` Andrew Morton
2013-03-12 21:52     ` Lucas De Marchi
2013-03-12 22:00       ` Andrew Morton
2013-03-12  0:48 ` [PATCH v3 3/7] kmod: split call to call_usermodehelper_fns() Lucas De Marchi
2013-03-12  0:48 ` [PATCH v3 4/7] KEYS: " Lucas De Marchi
2013-03-12  1:05   ` James Morris
2013-03-12  0:48 ` [PATCH v3 5/7] coredump: remove trailling whitespaces Lucas De Marchi
2013-03-12  0:48 ` Lucas De Marchi [this message]
2013-03-12  0:48 ` [PATCH v3 7/7] kmod: remove call_usermodehelper_fns() Lucas De Marchi
2013-03-25 12:56 ` [PATCH v3 4/7] KEYS: split call to call_usermodehelper_fns() David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1363049291-946-6-git-send-email-lucas.demarchi@profusion.mobi \
    --to=lucas.demarchi@profusion.mobi \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=james.l.morris@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucas.de.marchi@gmail.com \
    --cc=oleg@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.