Messages in this thread Patch in this message | | | From | Thomas Renninger <> | Subject | [PATCH] ACPI: Only allow users with CAP_SYS_RAWIO rights to overwrite ACPI funcs at runtime | Date | Tue, 25 Sep 2012 17:25:11 +0200 |
| |
ACPI: Only allow users with CAP_SYS_RAWIO rights to overwrite ACPI funcs at runtime
and tab align file_operations callbacks.
Signed-off-by: Thomas Renninger <trenn@suse.de> --- drivers/acpi/custom_method.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/custom_method.c b/drivers/acpi/custom_method.c index 5d42c24..9a0294d 100644 --- a/drivers/acpi/custom_method.c +++ b/drivers/acpi/custom_method.c @@ -72,9 +72,15 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf, return count; } +static int open_check_acc(struct inode *inode, struct file *filp) +{ + return capable(CAP_SYS_RAWIO) ? 0 : -EPERM; +} + static const struct file_operations cm_fops = { - .write = cm_write, - .llseek = default_llseek, + .write = cm_write, + .llseek = default_llseek, + .open = open_check_acc, }; static int __init acpi_custom_method_init(void)
| |