mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cong Wang <amwang@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
	WANG Cong <xiyou.wangcong@gmail.com>,
	Cyrill Gorcunov <gorcunov@openvz.org>,
	Kees Cook <keescook@chromium.org>,
	Serge Hallyn <serge.hallyn@canonical.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>
Subject: [Patch] kernel/sys.c: fix an incorrect error branch in orderly_poweroff()
Date: Wed,  4 Jul 2012 11:31:47 +0800	[thread overview]
Message-ID: <1341372710-14648-1-git-send-email-amwang@redhat.com> (raw)
In-Reply-To: <20120703152739.ea7df9e6.akpm@linux-foundation.org>

From: WANG Cong <xiyou.wangcong@gmail.com>

When argv_split() fails, argv is NULL, thus we should avoid calling
agrv_free(argv), and should jump after it.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Serge Hallyn <serge.hallyn@canonical.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>

---
diff --git a/kernel/sys.c b/kernel/sys.c
index e0c8ffc..ffa510f 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -2217,13 +2217,13 @@ int orderly_poweroff(bool force)
 
 	ret = call_usermodehelper_fns(argv[0], argv, envp, UMH_NO_WAIT,
 				      NULL, argv_cleanup, NULL);
-out:
 	if (likely(!ret))
 		return 0;
 
 	if (ret == -ENOMEM)
 		argv_free(argv);
 
+out:
 	if (force) {
 		printk(KERN_WARNING "Failed to start orderly shutdown: "
 		       "forcing the issue\n");

  parent reply	other threads:[~2012-07-04  3:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-28 18:32 New Defects based on recent changes in Kernel code found by Coverity Scan Scan Subscription
2012-07-03 22:27 ` Andrew Morton
2012-07-03 23:05   ` Bing Zhao
2012-07-04  3:31   ` Cong Wang [this message]
2012-07-04  6:44     ` [Patch] kernel/sys.c: fix an incorrect error branch in orderly_poweroff() David Rientjes
2012-07-04  6:56     ` Cyrill Gorcunov
2012-07-05  2:59     ` Kees Cook
2012-07-11 23:23     ` Andrew Morton
2012-07-11 23:32       ` Andrew Morton
2012-07-05 15:12   ` New Defects based on recent changes in Kernel code found by Coverity Scan Love, Robert W
2012-07-05 15:33   ` Chris Mason
2012-07-05 19:44     ` Andrew Morton

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=1341372710-14648-1-git-send-email-amwang@redhat.com \
    --to=amwang@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=ebiederm@xmission.com \
    --cc=gorcunov@openvz.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=serge.hallyn@canonical.com \
    --cc=xiyou.wangcong@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®