lkml.org 
[lkml]   [2012]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] ACPI: Only allow users with CAP_SYS_RAWIO rights to overwrite ACPI funcs at runtime
Date
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)

\
 
 \ /
  Last update: 2012-09-25 18:01    [W:0.060 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site