18c8249
From 32f701d40657cc3c982b8cba4bf73452ccdd6697 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
088a50c
index efbc3f0c592b..071171be4b7f 100644
6a91557
--- a/drivers/platform/x86/asus-wmi.c
6a91557
+++ b/drivers/platform/x86/asus-wmi.c
088a50c
@@ -1868,6 +1868,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)
088a50c
@@ -1884,6 +1887,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
 
088a50c
@@ -1908,6 +1914,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
-- 
18c8249
2.4.3
18c8249