]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
asus-wmi: Restrict debugfs interface when securelevel is set
authorMatthew Garrett <matthew.garrett@nebula.com>
Mon, 9 Sep 2013 22:49:45 +0000 (15:49 -0700)
committerSantosh Shilimkar <santosh.shilimkar@oracle.com>
Mon, 10 Aug 2015 16:24:06 +0000 (09:24 -0700)
Orabug: 21539498

We have no way of validating what all of the Asus WMI methods do on a
given machine, and there's a risk that some will allow hardware state to
be manipulated in such a way that arbitrary code can be executed in the
kernel. Prevent that if securelevel is set.

Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
drivers/platform/x86/asus-wmi.c

index 7543a56e0f4593c74fa74caee310a0ddbce4062c..08d54b499e824b9e98d984e1cc5e461f79647714 100644 (file)
@@ -45,6 +45,7 @@
 #include <linux/seq_file.h>
 #include <linux/platform_device.h>
 #include <linux/thermal.h>
+#include <linux/security.h>
 #include <linux/acpi.h>
 #include <linux/dmi.h>
 #include <acpi/video.h>
@@ -1589,6 +1590,9 @@ static int show_dsts(struct seq_file *m, void *data)
        int err;
        u32 retval = -1;
 
+       if (get_securelevel() > 0)
+               return -EPERM;
+
        err = asus_wmi_get_devstate(asus, asus->debug.dev_id, &retval);
 
        if (err < 0)
@@ -1605,6 +1609,9 @@ static int show_devs(struct seq_file *m, void *data)
        int err;
        u32 retval = -1;
 
+       if (get_securelevel() > 0)
+               return -EPERM;
+
        err = asus_wmi_set_devstate(asus->debug.dev_id, asus->debug.ctrl_param,
                                    &retval);
 
@@ -1629,6 +1636,9 @@ static int show_call(struct seq_file *m, void *data)
        union acpi_object *obj;
        acpi_status status;
 
+       if (get_securelevel() > 0)
+               return -EPERM;
+
        status = wmi_evaluate_method(ASUS_WMI_MGMT_GUID,
                                     1, asus->debug.method_id,
                                     &input, &output);