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>
This commit is contained in:
Oleg Drokin 2016-02-06 02:08:08 -05:00 коммит произвёл Rafael J. Wysocki
Родитель f6cede5b49
Коммит 1b6e75ee29
1 изменённых файлов: 3 добавлений и 0 удалений

Просмотреть файл

@ -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) {