6a91557
From: Matthew Garrett <matthew.garrett@nebula.com>
6a91557
Date: Fri, 9 Mar 2012 08:46:50 -0500
6a91557
Subject: [PATCH] asus-wmi: Restrict debugfs interface when module loading is
6a91557
 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
6a91557
index 21fc932da3a1..c6d42ad95c08 100644
6a91557
--- a/drivers/platform/x86/asus-wmi.c
6a91557
+++ b/drivers/platform/x86/asus-wmi.c
6a91557
@@ -1590,6 +1590,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)
6a91557
@@ -1606,6 +1609,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
 
6a91557
@@ -1630,6 +1636,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);
6a91557
-- 
1e63a38
2.1.0
6a91557