From 1b6e75ee295990d866ded77c29ffc6f88b831e26 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Sat, 6 Feb 2016 02:08:08 -0500 Subject: [PATCH] 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 Acked-by: Thomas Renninger Signed-off-by: Rafael J. Wysocki --- drivers/acpi/ec_sys.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/acpi/ec_sys.c b/drivers/acpi/ec_sys.c index bea8e425a8de..6c7dd7af789e 100644 --- a/drivers/acpi/ec_sys.c +++ b/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; int err = 0; + if (!write_support) + return -EINVAL; + if (*off >= EC_SPACE_SIZE) return 0; if (*off + count >= EC_SPACE_SIZE) { -- 2.20.1