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