summaryrefslogtreecommitdiffstats
path: root/kernel/power
diff options
context:
space:
mode:
authorRafael J. Wysocki2007-06-16 19:16:03 +0200
committerLinus Torvalds2007-06-16 22:16:15 +0200
commit2f41dddbbd7193fb5cdae0a24db4d378d56885fd (patch)
treedf51902d5e2e3f8f0429349b9a6abcac201c73cc /kernel/power
parenttoshiba_acpi: fix section mismatch in allyesconfig (diff)
downloadkernel-qcow2-linux-2f41dddbbd7193fb5cdae0a24db4d378d56885fd.tar.gz
kernel-qcow2-linux-2f41dddbbd7193fb5cdae0a24db4d378d56885fd.tar.xz
kernel-qcow2-linux-2f41dddbbd7193fb5cdae0a24db4d378d56885fd.zip
swsusp: Fix userland interface
Fix oops caused by 'cat /dev/snapshot', reported by Arkadiusz Miskiewicz, and make it impossible to thaw tasks with the help of the swsusp userland interface while there is a snapshot image ready to save. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/power')
-rw-r--r--kernel/power/user.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/power/user.c b/kernel/power/user.c
index 24d7d78e6f42..d65305b515b1 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -99,6 +99,8 @@ static ssize_t snapshot_read(struct file *filp, char __user *buf,
ssize_t res;
data = filp->private_data;
+ if (!data->ready)
+ return -ENODATA;
res = snapshot_read_next(&data->handle, count);
if (res > 0) {
if (copy_to_user(buf, data_of(data->handle), res))
@@ -245,7 +247,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
break;
case SNAPSHOT_UNFREEZE:
- if (!data->frozen)
+ if (!data->frozen || data->ready)
break;
mutex_lock(&pm_mutex);
thaw_processes();