From: Matthew Garrett Date: Mon, 9 Sep 2013 22:49:45 +0000 (-0700) Subject: asus-wmi: Restrict debugfs interface when securelevel is set X-Git-Tag: v4.1.12-92~310^2~4 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=16f61bd6608338962a768c4dbacd764843223ddc;p=users%2Fjedix%2Flinux-maple.git asus-wmi: Restrict debugfs interface when securelevel is set 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 Signed-off-by: Santosh Shilimkar --- diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 7543a56e0f45..08d54b499e82 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -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);