From: Pavel Machek <pavel@ucw.cz>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: stable@kernel.org, LKML <linux-kernel@vger.kernel.org>,
Stefan Seyfried <seife@suse.de>
Subject: Re: [PATCH] swsusp: Fix possible oops in userland interface
Date: Sun, 25 Feb 2007 20:54:31 +0100 [thread overview]
Message-ID: <20070225195431.GD1746@elf.ucw.cz> (raw)
In-Reply-To: <200702242306.44445.rjw@sisk.pl>
Hi!
> From: Stefan Seyfried <seife@suse.de>
>
> Fix the Oops occuring when SNAPSHOT_PMOPS or SNAPSHOT_S2RAM ioctl is called on
> a system without pm_ops defined (eg. a non-ACPI kernel on x86 PC).
>
> Signed-off-by: Stefan Seyfried <seife@suse.de>
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
ACK.
Pavel
> ---
>
> user.c | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> --- a/kernel/power/user.c 2007-02-01 01:07:38.000000000 +0100
> +++ b/kernel/power/user.c 2007-02-01 22:25:48.000000000 +0100
> @@ -292,7 +292,7 @@ static int snapshot_ioctl(struct inode *
> break;
> }
>
> - if (pm_ops->prepare) {
> + if (pm_ops && pm_ops->prepare) {
> error = pm_ops->prepare(PM_SUSPEND_MEM);
> if (error)
> goto OutS3;
> @@ -311,7 +311,7 @@ static int snapshot_ioctl(struct inode *
> device_resume();
> }
> resume_console();
> - if (pm_ops->finish)
> + if (pm_ops && pm_ops->finish)
> pm_ops->finish(PM_SUSPEND_MEM);
>
> OutS3:
> @@ -322,20 +322,25 @@ static int snapshot_ioctl(struct inode *
> switch (arg) {
>
> case PMOPS_PREPARE:
> - if (pm_ops->prepare) {
> + if (pm_ops && pm_ops->prepare)
> error = pm_ops->prepare(PM_SUSPEND_DISK);
> - }
> + else
> + error = -ENOSYS;
> break;
>
> case PMOPS_ENTER:
> kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
> - error = pm_ops->enter(PM_SUSPEND_DISK);
> + if (pm_ops && pm_ops->enter)
> + error = pm_ops->enter(PM_SUSPEND_DISK);
> + else
> + error = -ENOSYS;
> break;
>
> case PMOPS_FINISH:
> - if (pm_ops && pm_ops->finish) {
> + if (pm_ops && pm_ops->finish)
> pm_ops->finish(PM_SUSPEND_DISK);
> - }
> + else
> + error = -ENOSYS;
> break;
>
> default:
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
prev parent reply other threads:[~2007-02-25 19:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-24 22:06 Rafael J. Wysocki
2007-02-24 22:30 ` Rafael J. Wysocki
2007-02-25 19:54 ` Pavel Machek [this message]
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=20070225195431.GD1746@elf.ucw.cz \
--to=pavel@ucw.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=rjw@sisk.pl \
--cc=seife@suse.de \
--cc=stable@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
all inboxes | Powered by JetHome®