diff options
| author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-11-22 08:47:43 +0000 |
|---|---|---|
| committer | Chris Wilson <chris@chris-wilson.co.uk> | 2010-11-22 08:47:43 +0000 |
| commit | 4ab0fbd3a29067e1540f05093ae4ed07645d18c8 (patch) | |
| tree | 7f027e92e4578e293b20ac1f2c389600a795ea7f /kernel/printk.c | |
| parent | f3c91c1deaf8493526d8216be94c33e963f00962 (diff) | |
| parent | 3561d43fd289f590fdae672e5eb831b8d5cf0bf6 (diff) | |
Merge remote branch 'linus' into drm-intel-fixes
Diffstat (limited to 'kernel/printk.c')
| -rw-r--r-- | kernel/printk.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index 38e7d5868d6..9a2264fc42c 100644 --- a/kernel/printk.c +++ b/kernel/printk.c @@ -274,7 +274,20 @@ int do_syslog(int type, char __user *buf, int len, bool from_file) char c; int error = 0; - error = security_syslog(type, from_file); + /* + * If this is from /proc/kmsg we only do the capabilities checks + * at open time. + */ + if (type == SYSLOG_ACTION_OPEN || !from_file) { + if (dmesg_restrict && !capable(CAP_SYS_ADMIN)) + return -EPERM; + if ((type != SYSLOG_ACTION_READ_ALL && + type != SYSLOG_ACTION_SIZE_BUFFER) && + !capable(CAP_SYS_ADMIN)) + return -EPERM; + } + + error = security_syslog(type); if (error) return error; |
