LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] swsusp: Fix possible oops in userland interface
@ 2007-02-24 22:06 Rafael J. Wysocki
2007-02-24 22:30 ` Rafael J. Wysocki
2007-02-25 19:54 ` Pavel Machek
0 siblings, 2 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2007-02-24 22:06 UTC (permalink / raw)
To: stable; +Cc: LKML, Stefan Seyfried, Pavel Machek
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>
---
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:
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] swsusp: Fix possible oops in userland interface
2007-02-24 22:06 [PATCH] swsusp: Fix possible oops in userland interface Rafael J. Wysocki
@ 2007-02-24 22:30 ` Rafael J. Wysocki
2007-02-25 19:54 ` Pavel Machek
1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2007-02-24 22:30 UTC (permalink / raw)
To: stable; +Cc: LKML, Stefan Seyfried, Pavel Machek
On Saturday, 24 February 2007 23:06, Rafael J. Wysocki wrote:
> 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>
> ---
Sorry, I forgot to say: the patch is against 2.6.20 and for the 2.6.20.x stable
series.
Greetings,
Rafael
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] swsusp: Fix possible oops in userland interface
2007-02-24 22:06 [PATCH] swsusp: Fix possible oops in userland interface Rafael J. Wysocki
2007-02-24 22:30 ` Rafael J. Wysocki
@ 2007-02-25 19:54 ` Pavel Machek
1 sibling, 0 replies; 3+ messages in thread
From: Pavel Machek @ 2007-02-25 19:54 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: stable, LKML, Stefan Seyfried
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-02-25 19:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-24 22:06 [PATCH] swsusp: Fix possible oops in userland interface Rafael J. Wysocki
2007-02-24 22:30 ` Rafael J. Wysocki
2007-02-25 19:54 ` Pavel Machek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).