[PATCH 5/5] staging: android: logger: enforce GID and CAP check on log flush
From: John Stultz
Date: Wed Feb 27 2013 - 01:09:01 EST
From: Charndeep Grewal <csgrewa@xxxxxxxxxxxxxx>
Restrict log flushing to those in the logs group, or
anyone with CAP_SYSLOG.
Cc: Android Kernel Team <kernel-team@xxxxxxxxxxx>
Cc: Charndeep Grewal <csgrewa@xxxxxxxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Charndeep Grewal <csgrewa@xxxxxxxxxxxxxx>
Signed-off-by: John Stultz <john.stultz@xxxxxxxxxx>
---
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/