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