Browse Source

ACPI / EC: Deny write access unless requested by module param

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>
Oleg Drokin 9 years ago
parent
commit
1b6e75ee29
1 changed files with 3 additions and 0 deletions
  1. 3 0
      drivers/acpi/ec_sys.c

+ 3 - 0
drivers/acpi/ec_sys.c

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