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