diff mbox

power: disable hibernation if module loading is disabled

Message ID 1299255084-4390-1-git-send-email-segoon@openwall.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Vasiliy Kulikov March 4, 2011, 4:11 p.m. UTC
None
diff mbox

Patch

diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index 1832bd2..1ac9eee 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -328,6 +328,9 @@  int hibernation_snapshot(int platform_mode)
 {
 	int error;
 
+	if (modules_disabled)
+		return -EPERM;
+
 	error = platform_begin(platform_mode);
 	if (error)
 		goto Close;
@@ -385,6 +388,9 @@  static int resume_target_kernel(bool platform_mode)
 {
 	int error;
 
+	if (modules_disabled)
+		return -EPERM;
+
 	error = dpm_suspend_noirq(PMSG_QUIESCE);
 	if (error) {
 		printk(KERN_ERR "PM: Some devices failed to power down, "