ACPI / EC: Deny write access unless requested by module param
authorOleg Drokin <green@linuxhacker.ru>
Sat, 6 Feb 2016 07:08:08 +0000 (02:08 -0500)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 9 Mar 2016 22:26:15 +0000 (23:26 +0100)
In debugfs it's not enough to just set file mode to read-only to
deny write access to a file, instead just don't provide
the write method unless write access is really requested.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Acked-by: Thomas Renninger <trenn@suse.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/ec_sys.c

index bea8e425a8def6e81e4a7d506b2e38588f7af37b..6c7dd7af789e453ce3d16ae80b849ef38bc4a3c0 100644 (file)
@@ -73,6 +73,9 @@ static ssize_t acpi_ec_write_io(struct file *f, const char __user *buf,
        loff_t init_off = *off;
        int err = 0;
 
+       if (!write_support)
+               return -EINVAL;
+
        if (*off >= EC_SPACE_SIZE)
                return 0;
        if (*off + count >= EC_SPACE_SIZE) {