acpi/ec: Deny write access unless requested by module param
PATCH 1/1 acpi/ec: Deny write access unless requested by module param
From: Oleg Drokin <[email protected]>
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.
---
I assume allowing run-time changes via /sys/module is preferrable, opposed to forced module unload and reload to change this option, but I can submit another patch to only depend on the module parameter too, please let me know.
drivers/acpi/ec_sys.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/acpi/ec_sys.c +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 ) {
Signature · 1 line
2.1.0
Quoted 7 lines · On Saturday, February 06, 2016 02:08:08 AM [email protected] wrote:
From: Oleg Drokin <[email protected]>
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 <[email protected]>
Thanks!
Quoted 23 lines
---
I assume allowing run-time changes via/sys/moduleis preferrable, opposed to forced module unload and reload to change this option, but I can submit another patch to only depend on the module parameter too, please let me know.drivers/acpi/ec_sys.c | 3 +++ 1 file changed, 3 insertions(+)drivers/acpi/ec_sys.c +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 ) {
Rafael J. Wysocki
AppliedQuoted 22 lines · On Saturday, February 06, 2016 02:08:08 AM [email protected] wrote:
From: Oleg Drokin <[email protected]>
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 <[email protected]>---
I assume allowing run-time changes via/sys/moduleis preferrable, opposed to forced module unload and reload to change this option, but I can submit another patch to only depend on the module parameter too, please let me know.drivers/acpi/ec_sys.c | 3 +++ 1 file changed, 3 insertions(+)drivers/acpi/ec_sys.c +0
-0
drivers/acpi/ec_sys.c static ssize_t acpi_ec_write_io(struct file *f, const char __user *buf, · line 81
Quoted 9 lines
drivers/acpi/ec_sys.c +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 ) {
Applied, thanks!
Rafael