Skip to contentSkip to conversation

fix oops on cat /dev/snapshot

PATCH Pavel Machek 2 participants 3 messages Jun 11, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

What /dev/snapshot is simply cat-ed -- without ioctls used in normal operation -- it oopses. This one should fix it.

kernel/power/user.c +2 -0
@@ -99,6 +99,8 @@
 	ssize_t res;
 
 	data = filp->private_data;
+	if (!data->ready)
+		return -EINVAL;
 	res = snapshot_read_next(&data->handle, count);
 	if (res > 0) {
 		if (copy_to_user(buf, data_of(data->handle), res))
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#1 lore raw

kernel/power/user.c line 103

Quoted 13 lines · Pavel Machek

What /dev/snapshot is simply cat-ed -- without ioctls used in normal operation -- it oopses. This one should fix it.

kernel/power/user.c +2 -0
@@ -99,6 +99,8 @@
 	ssize_t res;
 
 	data = filp->private_data;
+	if (!data->ready)
+		return -EINVAL;

I'd like to use -ENODATA here.

kernel/power/user.c line 106

Quoted 4 lines
kernel/power/user.c +0 -0
 	res = snapshot_read_next(&data->handle, count);
 	if (res > 0) {
 		if (copy_to_user(buf, data_of(data->handle), res))

I have a patch for that and I'm going to post it in a while if you don't mind.

I've already posted it once, here: http://lkml.org/lkml/2007/6/10/146

Greetings,
Rafael

Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
#2 lore raw

Hi!

Quoted 21 lines

kernel/power/user.c line 103

Quoted 13 lines

What /dev/snapshot is simply cat-ed -- without ioctls used in normal operation -- it oopses. This one should fix it.

kernel/power/user.c +2 -0
@@ -99,6 +99,8 @@
 	ssize_t res;
 
 	data = filp->private_data;
+	if (!data->ready)
+		return -EINVAL;

I'd like to use -ENODATA here.

kernel/power/user.c line 106

Quoted 4 lines
kernel/power/user.c +0 -0
 	res = snapshot_read_next(&data->handle, count);
 	if (res > 0) {
 		if (copy_to_user(buf, data_of(data->handle), res))
Quoted 4 lines

I have a patch for that and I'm going to post it in a while if you don't mind.

I've already posted it once, here: http://lkml.org/lkml/2007/6/10/146

Aha, go ahead, I did not notice that mail.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html