ea38f2f
From ebbd8d01acdf472594f7e43e9a4274745c402e8e Mon Sep 17 00:00:00 2001
6a91557
From: Matthew Garrett <matthew.garrett@nebula.com>
6a91557
Date: Fri, 9 Mar 2012 08:46:50 -0500
18c8249
Subject: [PATCH 05/20] asus-wmi: Restrict debugfs interface when module
18c8249
 loading is restricted
6a91557
6a91557
We have no way of validating what all of the Asus WMI methods do on a
6a91557
given machine, and there's a risk that some will allow hardware state to
6a91557
be manipulated in such a way that arbitrary code can be executed in the
6a91557
kernel, circumventing module loading restrictions. Prevent that if any of
6a91557
these features are enabled.
6a91557
6a91557
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
6a91557
---
6a91557
 drivers/platform/x86/asus-wmi.c | 9 +++++++++
6a91557
 1 file changed, 9 insertions(+)
6a91557
6a91557
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
ea38f2f
index ce6ca31a2d09..55d23994d6a2 100644
6a91557
--- a/drivers/platform/x86/asus-wmi.c
6a91557
+++ b/drivers/platform/x86/asus-wmi.c
ea38f2f
@@ -1872,6 +1872,9 @@ static int show_dsts(struct seq_file *m, void *data)
6a91557
 	int err;
6a91557
 	u32 retval = -1;
6a91557
 
6a91557
+	if (secure_modules())
6a91557
+		return -EPERM;
6a91557
+
6a91557
 	err = asus_wmi_get_devstate(asus, asus->debug.dev_id, &retval);
6a91557
 
6a91557
 	if (err < 0)
ea38f2f
@@ -1888,6 +1891,9 @@ static int show_devs(struct seq_file *m, void *data)
6a91557
 	int err;
6a91557
 	u32 retval = -1;
6a91557
 
6a91557
+	if (secure_modules())
6a91557
+		return -EPERM;
6a91557
+
6a91557
 	err = asus_wmi_set_devstate(asus->debug.dev_id, asus->debug.ctrl_param,
6a91557
 				    &retval);
6a91557
 
ea38f2f
@@ -1912,6 +1918,9 @@ static int show_call(struct seq_file *m, void *data)
6a91557
 	union acpi_object *obj;
6a91557
 	acpi_status status;
6a91557
 
6a91557
+	if (secure_modules())
6a91557
+		return -EPERM;
6a91557
+
6a91557
 	status = wmi_evaluate_method(ASUS_WMI_MGMT_GUID,
6a91557
 				     1, asus->debug.method_id,
6a91557
 				     &input, &output);
18c8249
-- 
ea38f2f
2.9.3
18c8249