From: Andrew Morton <akpm@linux-foundation.org>
To: Andi Kleen <andi@firstfloor.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Clean up sys_shutdown
Date: Thu, 9 Apr 2009 22:14:16 -0700 [thread overview]
Message-ID: <20090409221416.9a74f7fa.akpm@linux-foundation.org> (raw)
In-Reply-To: <20090407223626.GA25557@basil.nowhere.org>
On Wed, 8 Apr 2009 00:36:26 +0200 Andi Kleen <andi@firstfloor.org> wrote:
> Clean up sys_shutdown exit path
>
> Impact: cleanup, fix
>
> Clean up sys_shutdown exit path. Factor out common code.
OK.
> Return
> correct error code instead of always 0 on failure.
oh goody, that makes the patch a bugfix.
> --- linux.orig/kernel/sys.c 2009-04-07 16:09:58.000000000 +0200
> +++ linux/kernel/sys.c 2009-04-07 16:43:17.000000000 +0200
> @@ -360,6 +360,7 @@
> void __user *, arg)
> {
> char buffer[256];
> + int ret = 0;
>
> /* We only trust the superuser with rebooting the system. */
> if (!capable(CAP_SYS_BOOT))
> @@ -397,7 +398,7 @@
> kernel_halt();
> unlock_kernel();
> do_exit(0);
> - break;
> + panic("cannot halt");
>
> case LINUX_REBOOT_CMD_POWER_OFF:
> kernel_power_off();
> @@ -417,29 +418,22 @@
>
> #ifdef CONFIG_KEXEC
> case LINUX_REBOOT_CMD_KEXEC:
> - {
> - int ret;
> - ret = kernel_kexec();
> - unlock_kernel();
> - return ret;
> - }
> + ret = kernel_kexec();
> + break;
> #endif
>
> #ifdef CONFIG_HIBERNATION
> case LINUX_REBOOT_CMD_SW_SUSPEND:
> - {
> - int ret = hibernate();
> - unlock_kernel();
> - return ret;
> - }
> + ret = hibernate();
> + break;
> #endif
>
> default:
> - unlock_kernel();
> - return -EINVAL;
> + ret = -EINVAL;
> + break;
> }
> unlock_kernel();
> - return 0;
> + return ret;
> }
I wonder why this code uses lock_kernel().
next prev parent reply other threads:[~2009-04-10 5:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-07 22:36 [PATCH] Clean up sys_shutdown Andi Kleen
2009-04-10 5:14 ` Andrew Morton [this message]
2009-04-10 8:38 ` Andi Kleen
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=20090409221416.9a74f7fa.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=linux-kernel@vger.kernel.org \
/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