diff options
Diffstat (limited to 'kernel/printk.c')
-rw-r--r-- | kernel/printk.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index 38e7d5868d60..a23315dc4498 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) | |||
274 | char c; | 274 | char c; |
275 | int error = 0; | 275 | int error = 0; |
276 | 276 | ||
277 | error = security_syslog(type, from_file); | 277 | /* |
278 | * If this is from /proc/kmsg we only do the capabilities checks | ||
279 | * at open time. | ||
280 | */ | ||
281 | if (type == SYSLOG_ACTION_OPEN || !from_file) { | ||
282 | if (dmesg_restrict && !capable(CAP_SYS_ADMIN)) | ||
283 | return -EPERM; | ||
284 | if ((type != SYSLOG_ACTION_READ_ALL && | ||
285 | type != SYSLOG_ACTION_SIZE_BUFFER) && | ||
286 | !capable(CAP_SYS_ADMIN)) | ||
287 | return -EPERM; | ||
288 | } | ||
289 | |||
290 | error = security_syslog(type); | ||
278 | if (error) | 291 | if (error) |
279 | return error; | 292 | return error; |
280 | 293 | ||
@@ -1069,13 +1082,15 @@ void printk_tick(void) | |||
1069 | 1082 | ||
1070 | int printk_needs_cpu(int cpu) | 1083 | int printk_needs_cpu(int cpu) |
1071 | { | 1084 | { |
1085 | if (unlikely(cpu_is_offline(cpu))) | ||
1086 | printk_tick(); | ||
1072 | return per_cpu(printk_pending, cpu); | 1087 | return per_cpu(printk_pending, cpu); |
1073 | } | 1088 | } |
1074 | 1089 | ||
1075 | void wake_up_klogd(void) | 1090 | void wake_up_klogd(void) |
1076 | { | 1091 | { |
1077 | if (waitqueue_active(&log_wait)) | 1092 | if (waitqueue_active(&log_wait)) |
1078 | __raw_get_cpu_var(printk_pending) = 1; | 1093 | this_cpu_write(printk_pending, 1); |
1079 | } | 1094 | } |
1080 | 1095 | ||
1081 | /** | 1096 | /** |