Signed-off-by: Thomas Renninger <[email protected]>
---
 drivers/acpi/ec_sys.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/ec_sys.c b/drivers/acpi/ec_sys.c
index 7586544..51dea3b 100644
--- a/drivers/acpi/ec_sys.c
+++ b/drivers/acpi/ec_sys.c
@@ -12,6 +12,8 @@
 #include <linux/acpi.h>
 #include <linux/debugfs.h>
 #include <linux/module.h>
+#include <linux/capability.h>
+
 #include "internal.h"
 
 MODULE_AUTHOR("Thomas Renninger <[email protected]>");
@@ -68,6 +70,9 @@ static ssize_t acpi_ec_write_io(struct file *f, const char 
__user *buf,
        u8 *data = (u8 *) buf;
        int err = 0;
 
+       if (!capable(CAP_COMPROMISE_KERNEL))
+               return -EPERM;
+
        if (*off >= EC_SPACE_SIZE)
                return 0;
        if (*off + count >= EC_SPACE_SIZE) {
@@ -121,8 +126,13 @@ int acpi_ec_add_debugfs(struct acpi_ec *ec, unsigned int 
ec_device_count)
                                 (u32 *)&first_ec->global_lock))
                goto error;
 
-       if (write_support)
-               mode = 0600;
+       if (write_support) {
+               if (!capable(CAP_COMPROMISE_KERNEL))
+                       pr_err("No write access to EC\n");
+               else
+                       mode = 0600;
+       }
+
        if (!debugfs_create_file("io", mode, dev_dir, ec, &acpi_ec_io_ops))
                goto error;
 
-- 
1.7.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to