linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Stultz <john.stultz@linaro.org>
To: lkml <linux-kernel@vger.kernel.org>
Cc: Charndeep Grewal <csgrewa@tycho.ncsc.mil>,
	Android Kernel Team <kernel-team@android.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	John Stultz <john.stultz@linaro.org>
Subject: [PATCH 5/5] staging: android: logger: enforce GID and CAP check on log flush
Date: Tue, 26 Feb 2013 22:07:38 -0800	[thread overview]
Message-ID: <1361945258-24420-6-git-send-email-john.stultz@linaro.org> (raw)
In-Reply-To: <1361945258-24420-1-git-send-email-john.stultz@linaro.org>

From: Charndeep Grewal <csgrewa@tycho.ncsc.mil>

Restrict log flushing to those in the logs group, or
anyone with CAP_SYSLOG.

Cc: Android Kernel Team <kernel-team@android.com>
Cc: Charndeep Grewal <csgrewa@tycho.ncsc.mil>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Charndeep Grewal <csgrewa@tycho.ncsc.mil>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 drivers/staging/android/logger.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c
index cfa6061..b14a557 100644
--- a/drivers/staging/android/logger.c
+++ b/drivers/staging/android/logger.c
@@ -695,6 +695,11 @@ static long logger_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 			ret = -EBADF;
 			break;
 		}
+		if (!(in_egroup_p(file->f_dentry->d_inode->i_gid) ||
+				capable(CAP_SYSLOG))) {
+			ret = -EPERM;
+			break;
+		}
 		list_for_each_entry(reader, &log->readers, list)
 			reader->r_off = log->w_off;
 		log->head = log->w_off;
-- 
1.7.10.4


  parent reply	other threads:[~2013-02-27  6:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-27  6:07 [PATCH 0/5] staging: Updates from the Android tree (for 3.10) John Stultz
2013-02-27  6:07 ` [PATCH 1/5] staging: android: lowmemorykiller: Add config option to support oom_adj values John Stultz
2013-02-27 22:18   ` David Rientjes
2013-02-27 22:38     ` Arve Hjønnevåg
2013-02-27 23:12       ` David Rientjes
2013-02-27 23:47         ` Arve Hjønnevåg
2013-02-28  0:14           ` David Rientjes
2013-02-28  1:05             ` Arve Hjønnevåg
2013-02-28  1:41               ` David Rientjes
2013-02-27  6:07 ` [PATCH 2/5] staging: android: lowmemorykiller: Don't count reserved free memory John Stultz
2013-02-27 22:19   ` David Rientjes
2013-02-27  6:07 ` [PATCH 3/5] staging: android: lowmemorykiller: Change default debug_level to 1 John Stultz
2013-02-27  6:07 ` [PATCH 4/5] staging: android: logger: Allow a UID to read it's own log entries John Stultz
2013-02-27  6:07 ` John Stultz [this message]
2013-03-05  8:39 ` [PATCH 0/5] staging: Updates from the Android tree (for 3.10) Greg Kroah-Hartman
2013-03-05  9:56   ` John Stultz

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=1361945258-24420-6-git-send-email-john.stultz@linaro.org \
    --to=john.stultz@linaro.org \
    --cc=csgrewa@tycho.ncsc.mil \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.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).