[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <201209251725.13085.trenn@suse.de>
Date: Tue, 25 Sep 2012 17:25:11 +0200
From: Thomas Renninger <trenn@...e.de>
To: Len Brown <lenb@...nel.org>
Cc: Alan Cox <alan@...rguk.ukuu.org.uk>, hpa@...or.com,
initramfs@...r.kernel.org, robert.moore@...el.com,
linux-kernel@...r.kernel.org, linux-acpi@...r.kernel.org,
yinghai@...nel.org, eric.piel@...mplin-utc.net, vojcek@...n.pl
Subject: [PATCH] ACPI: Only allow users with CAP_SYS_RAWIO rights to overwrite ACPI funcs at runtime
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@...e.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)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists