lkml.org 
[lkml]   [2012]   [Jul]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[Patch] kernel/sys.c: fix an incorrect error branch in orderly_poweroff()
Date
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");

\
 
 \ /
  Last update: 2012-07-04 06:01    [W:0.121 / U:1.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site