LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH -mm] swsusp: Fix possible oops in userland interface
@ 2007-02-06 22:41 Rafael J. Wysocki
0 siblings, 0 replies; only message in thread
From: Rafael J. Wysocki @ 2007-02-06 22:41 UTC (permalink / raw)
To: Andrew Morton; +Cc: LKML, Nigel Cunningham, Pavel Machek, Stefan Seyfried
The SNAPSHOT_PMOPS and SNAPSHOT_S2RAM ioctls can Oops if they are called from
a kernel that doesn't set pm_ops (eg. non-ACPI kernel on a PC). Fix it.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
---
kernel/power/user.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
Index: linux-2.6.20-rc6-mm3/kernel/power/user.c
===================================================================
--- linux-2.6.20-rc6-mm3.orig/kernel/power/user.c 2007-02-04 18:36:21.000000000 +0100
+++ linux-2.6.20-rc6-mm3/kernel/power/user.c 2007-02-04 18:56:53.000000000 +0100
@@ -341,6 +341,11 @@ static int snapshot_ioctl(struct inode *
break;
case SNAPSHOT_S2RAM:
+ if (!pm_ops) {
+ error = -ENOSYS;
+ break;
+ }
+
if (!data->frozen) {
error = -EPERM;
break;
@@ -383,8 +388,12 @@ static int snapshot_ioctl(struct inode *
switch (arg) {
case PMOPS_PREPARE:
- data->platform_suspend = 1;
- error = 0;
+ if (pm_ops && pm_ops->enter) {
+ data->platform_suspend = 1;
+ error = 0;
+ } else {
+ error = -ENOSYS;
+ }
break;
case PMOPS_ENTER:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-02-06 22:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-06 22:41 [PATCH -mm] swsusp: Fix possible oops in userland interface Rafael J. Wysocki
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).