linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Renninger <trenn@suse.de>
To: Len Brown <lenb@kernel.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	hpa@zytor.com, initramfs@vger.kernel.org, robert.moore@intel.com,
	linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
	yinghai@kernel.org, eric.piel@tremplin-utc.net, vojcek@tlen.pl
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	[thread overview]
Message-ID: <201209251725.13085.trenn@suse.de> (raw)
In-Reply-To: <20120924102159.346d0735@pyramind.ukuu.org.uk>

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)

  reply	other threads:[~2012-09-25 15:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-21 13:28 Early cpio decoder and ACPI table override via initrd making use of it Thomas Renninger
2012-09-21 13:28 ` [PATCH 1/2] lib: Add early cpio decoder Thomas Renninger
2012-09-21 13:28 ` [PATCH 2/2] ACPI: Override arbitrary ACPI tables via initrd for debugging Thomas Renninger
     [not found]   ` <1348234085-39220-3-git-send-email-trenn-l3A5Bk7waGM@public.gmane.org>
2012-09-21 20:56     ` Yinghai Lu
     [not found]       ` <CAE9FiQX64iRo9QjhEPYtEOhbEweKSmTssQ50VfPznWtHA345CQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-09-25 14:17         ` Thomas Renninger
2012-09-22 15:16   ` Len Brown
     [not found]     ` <505DD65F.9080203-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2012-09-23  1:17       ` Thomas Renninger
     [not found]         ` <201209230317.04050.trenn-l3A5Bk7waGM@public.gmane.org>
2012-09-23  4:25           ` Len Brown
2012-09-24  6:40             ` Thomas Renninger
2012-09-24  9:21               ` Alan Cox
2012-09-25 15:25                 ` Thomas Renninger [this message]
2012-09-24 18:26             ` Matthew Garrett
2012-09-24 20:27     ` H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201209251725.13085.trenn@suse.de \
    --to=trenn@suse.de \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=eric.piel@tremplin-utc.net \
    --cc=hpa@zytor.com \
    --cc=initramfs@vger.kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robert.moore@intel.com \
    --cc=vojcek@tlen.pl \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).