lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Tue, 6 Feb 2007 23:41:59 +0100
From:	"Rafael J. Wysocki" <rjw@...k.pl>
To:	Andrew Morton <akpm@...l.org>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Nigel Cunningham <ncunningham@...uxmail.org>,
	Pavel Machek <pavel@....cz>, Stefan Seyfried <seife@...e.de>
Subject: [PATCH -mm] swsusp: Fix possible oops in userland interface

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@...k.pl>
Acked-by: Pavel Machek <pavel@....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:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ