From patchwork Fri Mar 4 16:11:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasiliy Kulikov X-Patchwork-Id: 609641 Received: from smtp1.linux-foundation.org (smtp1.linux-foundation.org [140.211.169.13]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p24GTbR5031091 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Fri, 4 Mar 2011 16:30:02 GMT Received: from daredevil.linux-foundation.org (localhost [127.0.0.1]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p24GRvZx005416; Fri, 4 Mar 2011 08:27:57 -0800 Received: from mail-bw0-f47.google.com (mail-bw0-f47.google.com [209.85.214.47]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p24GBTi7003765 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Fri, 4 Mar 2011 08:11:32 -0800 Received: by bwz10 with SMTP id 10so2071489bwz.6 for ; Fri, 04 Mar 2011 08:11:29 -0800 (PST) Received: by 10.204.18.204 with SMTP id x12mr740278bka.46.1299255089304; Fri, 04 Mar 2011 08:11:29 -0800 (PST) Received: from localhost (ppp85-141-215-203.pppoe.mtu-net.ru [85.141.215.203]) by mx.google.com with ESMTPS id a15sm548853faw.3.2011.03.04.08.11.26 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 Mar 2011 08:11:27 -0800 (PST) From: Vasiliy Kulikov To: linux-kernel@vger.kernel.org Date: Fri, 4 Mar 2011 19:11:24 +0300 Message-Id: <1299255084-4390-1-git-send-email-segoon@openwall.com> X-Mailer: git-send-email 1.7.0.4 Received-SPF: pass (localhost is always allowed.) X-Spam-Status: No, hits=-6.169 required=5 tests=AWL, BAYES_00, OSDL_HEADER_SPF_PASS, OSDL_HEADER_SUBJECT_BRACKETED, PATCH_SUBJECT_OSDL X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.21 X-Mailman-Approved-At: Fri, 04 Mar 2011 08:27:56 -0800 Cc: Len Brown , security@kernel.org, linux-pm@lists.linux-foundation.org Subject: [linux-pm] [PATCH] power: disable hibernation if module loading is disabled X-BeenThere: linux-pm@lists.linux-foundation.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux power management List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-pm-bounces@lists.linux-foundation.org Errors-To: linux-pm-bounces@lists.linux-foundation.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 04 Mar 2011 16:30:02 +0000 (UTC) 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, "