aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/capability.c4
-rw-r--r--kernel/futex_compat.c6
-rw-r--r--kernel/posix-timers.c2
-rw-r--r--kernel/printk.c52
-rw-r--r--kernel/sysctl.c2
-rw-r--r--kernel/taskstats.c6
-rw-r--r--kernel/time/clocksource.c14
-rw-r--r--kernel/time/ntp.c10
-rw-r--r--kernel/time/timekeeping.c1
-rw-r--r--kernel/trace/blktrace.c5
10 files changed, 54 insertions, 48 deletions
diff --git a/kernel/capability.c b/kernel/capability.c
index 7f876e60521f..9e4697e9b276 100644
--- a/kernel/capability.c
+++ b/kernel/capability.c
@@ -135,7 +135,7 @@ static inline int cap_get_target_pid(pid_t pid, kernel_cap_t *pEp,
135 if (pid && (pid != task_pid_vnr(current))) { 135 if (pid && (pid != task_pid_vnr(current))) {
136 struct task_struct *target; 136 struct task_struct *target;
137 137
138 read_lock(&tasklist_lock); 138 rcu_read_lock();
139 139
140 target = find_task_by_vpid(pid); 140 target = find_task_by_vpid(pid);
141 if (!target) 141 if (!target)
@@ -143,7 +143,7 @@ static inline int cap_get_target_pid(pid_t pid, kernel_cap_t *pEp,
143 else 143 else
144 ret = security_capget(target, pEp, pIp, pPp); 144 ret = security_capget(target, pEp, pIp, pPp);
145 145
146 read_unlock(&tasklist_lock); 146 rcu_read_unlock();
147 } else 147 } else
148 ret = security_capget(current, pEp, pIp, pPp); 148 ret = security_capget(current, pEp, pIp, pPp);
149 149
diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c
index 235716556bf1..d49afb2395e5 100644
--- a/kernel/futex_compat.c
+++ b/kernel/futex_compat.c
@@ -146,7 +146,7 @@ compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
146 struct task_struct *p; 146 struct task_struct *p;
147 147
148 ret = -ESRCH; 148 ret = -ESRCH;
149 read_lock(&tasklist_lock); 149 rcu_read_lock();
150 p = find_task_by_vpid(pid); 150 p = find_task_by_vpid(pid);
151 if (!p) 151 if (!p)
152 goto err_unlock; 152 goto err_unlock;
@@ -157,7 +157,7 @@ compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
157 !capable(CAP_SYS_PTRACE)) 157 !capable(CAP_SYS_PTRACE))
158 goto err_unlock; 158 goto err_unlock;
159 head = p->compat_robust_list; 159 head = p->compat_robust_list;
160 read_unlock(&tasklist_lock); 160 rcu_read_unlock();
161 } 161 }
162 162
163 if (put_user(sizeof(*head), len_ptr)) 163 if (put_user(sizeof(*head), len_ptr))
@@ -165,7 +165,7 @@ compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
165 return put_user(ptr_to_compat(head), head_ptr); 165 return put_user(ptr_to_compat(head), head_ptr);
166 166
167err_unlock: 167err_unlock:
168 read_unlock(&tasklist_lock); 168 rcu_read_unlock();
169 169
170 return ret; 170 return ret;
171} 171}
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index 495440779ce3..00d1fda58ab6 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -256,7 +256,7 @@ static int posix_get_monotonic_coarse(clockid_t which_clock,
256 return 0; 256 return 0;
257} 257}
258 258
259int posix_get_coarse_res(const clockid_t which_clock, struct timespec *tp) 259static int posix_get_coarse_res(const clockid_t which_clock, struct timespec *tp)
260{ 260{
261 *tp = ktime_to_timespec(KTIME_LOW_RES); 261 *tp = ktime_to_timespec(KTIME_LOW_RES);
262 return 0; 262 return 0;
diff --git a/kernel/printk.c b/kernel/printk.c
index 1751c456b71f..40674122ecf2 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -35,6 +35,7 @@
35#include <linux/kexec.h> 35#include <linux/kexec.h>
36#include <linux/ratelimit.h> 36#include <linux/ratelimit.h>
37#include <linux/kmsg_dump.h> 37#include <linux/kmsg_dump.h>
38#include <linux/syslog.h>
38 39
39#include <asm/uaccess.h> 40#include <asm/uaccess.h>
40 41
@@ -258,38 +259,23 @@ static inline void boot_delay_msec(void)
258} 259}
259#endif 260#endif
260 261
261/* 262int do_syslog(int type, char __user *buf, int len, bool from_file)
262 * Commands to do_syslog:
263 *
264 * 0 -- Close the log. Currently a NOP.
265 * 1 -- Open the log. Currently a NOP.
266 * 2 -- Read from the log.
267 * 3 -- Read all messages remaining in the ring buffer.
268 * 4 -- Read and clear all messages remaining in the ring buffer
269 * 5 -- Clear ring buffer.
270 * 6 -- Disable printk's to console
271 * 7 -- Enable printk's to console
272 * 8 -- Set level of messages printed to console
273 * 9 -- Return number of unread characters in the log buffer
274 * 10 -- Return size of the log buffer
275 */
276int do_syslog(int type, char __user *buf, int len)
277{ 263{
278 unsigned i, j, limit, count; 264 unsigned i, j, limit, count;
279 int do_clear = 0; 265 int do_clear = 0;
280 char c; 266 char c;
281 int error = 0; 267 int error = 0;
282 268
283 error = security_syslog(type); 269 error = security_syslog(type, from_file);
284 if (error) 270 if (error)
285 return error; 271 return error;
286 272
287 switch (type) { 273 switch (type) {
288 case 0: /* Close log */ 274 case SYSLOG_ACTION_CLOSE: /* Close log */
289 break; 275 break;
290 case 1: /* Open log */ 276 case SYSLOG_ACTION_OPEN: /* Open log */
291 break; 277 break;
292 case 2: /* Read from log */ 278 case SYSLOG_ACTION_READ: /* Read from log */
293 error = -EINVAL; 279 error = -EINVAL;
294 if (!buf || len < 0) 280 if (!buf || len < 0)
295 goto out; 281 goto out;
@@ -320,10 +306,12 @@ int do_syslog(int type, char __user *buf, int len)
320 if (!error) 306 if (!error)
321 error = i; 307 error = i;
322 break; 308 break;
323 case 4: /* Read/clear last kernel messages */ 309 /* Read/clear last kernel messages */
310 case SYSLOG_ACTION_READ_CLEAR:
324 do_clear = 1; 311 do_clear = 1;
325 /* FALL THRU */ 312 /* FALL THRU */
326 case 3: /* Read last kernel messages */ 313 /* Read last kernel messages */
314 case SYSLOG_ACTION_READ_ALL:
327 error = -EINVAL; 315 error = -EINVAL;
328 if (!buf || len < 0) 316 if (!buf || len < 0)
329 goto out; 317 goto out;
@@ -376,21 +364,25 @@ int do_syslog(int type, char __user *buf, int len)
376 } 364 }
377 } 365 }
378 break; 366 break;
379 case 5: /* Clear ring buffer */ 367 /* Clear ring buffer */
368 case SYSLOG_ACTION_CLEAR:
380 logged_chars = 0; 369 logged_chars = 0;
381 break; 370 break;
382 case 6: /* Disable logging to console */ 371 /* Disable logging to console */
372 case SYSLOG_ACTION_CONSOLE_OFF:
383 if (saved_console_loglevel == -1) 373 if (saved_console_loglevel == -1)
384 saved_console_loglevel = console_loglevel; 374 saved_console_loglevel = console_loglevel;
385 console_loglevel = minimum_console_loglevel; 375 console_loglevel = minimum_console_loglevel;
386 break; 376 break;
387 case 7: /* Enable logging to console */ 377 /* Enable logging to console */
378 case SYSLOG_ACTION_CONSOLE_ON:
388 if (saved_console_loglevel != -1) { 379 if (saved_console_loglevel != -1) {
389 console_loglevel = saved_console_loglevel; 380 console_loglevel = saved_console_loglevel;
390 saved_console_loglevel = -1; 381 saved_console_loglevel = -1;
391 } 382 }
392 break; 383 break;
393 case 8: /* Set level of messages printed to console */ 384 /* Set level of messages printed to console */
385 case SYSLOG_ACTION_CONSOLE_LEVEL:
394 error = -EINVAL; 386 error = -EINVAL;
395 if (len < 1 || len > 8) 387 if (len < 1 || len > 8)
396 goto out; 388 goto out;
@@ -401,10 +393,12 @@ int do_syslog(int type, char __user *buf, int len)
401 saved_console_loglevel = -1; 393 saved_console_loglevel = -1;
402 error = 0; 394 error = 0;
403 break; 395 break;
404 case 9: /* Number of chars in the log buffer */ 396 /* Number of chars in the log buffer */
397 case SYSLOG_ACTION_SIZE_UNREAD:
405 error = log_end - log_start; 398 error = log_end - log_start;
406 break; 399 break;
407 case 10: /* Size of the log buffer */ 400 /* Size of the log buffer */
401 case SYSLOG_ACTION_SIZE_BUFFER:
408 error = log_buf_len; 402 error = log_buf_len;
409 break; 403 break;
410 default: 404 default:
@@ -417,7 +411,7 @@ out:
417 411
418SYSCALL_DEFINE3(syslog, int, type, char __user *, buf, int, len) 412SYSCALL_DEFINE3(syslog, int, type, char __user *, buf, int, len)
419{ 413{
420 return do_syslog(type, buf, len); 414 return do_syslog(type, buf, len, SYSLOG_FROM_CALL);
421} 415}
422 416
423/* 417/*
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 8a68b2448468..33e7a38b6eb9 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1441,7 +1441,7 @@ static struct ctl_table fs_table[] = {
1441}; 1441};
1442 1442
1443static struct ctl_table debug_table[] = { 1443static struct ctl_table debug_table[] = {
1444#if defined(CONFIG_X86) || defined(CONFIG_PPC) 1444#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC)
1445 { 1445 {
1446 .procname = "exception-trace", 1446 .procname = "exception-trace",
1447 .data = &show_unhandled_signals, 1447 .data = &show_unhandled_signals,
diff --git a/kernel/taskstats.c b/kernel/taskstats.c
index ea8384d3caa7..899ca51be5e8 100644
--- a/kernel/taskstats.c
+++ b/kernel/taskstats.c
@@ -46,15 +46,13 @@ static struct genl_family family = {
46 .maxattr = TASKSTATS_CMD_ATTR_MAX, 46 .maxattr = TASKSTATS_CMD_ATTR_MAX,
47}; 47};
48 48
49static struct nla_policy taskstats_cmd_get_policy[TASKSTATS_CMD_ATTR_MAX+1] 49static const struct nla_policy taskstats_cmd_get_policy[TASKSTATS_CMD_ATTR_MAX+1] = {
50__read_mostly = {
51 [TASKSTATS_CMD_ATTR_PID] = { .type = NLA_U32 }, 50 [TASKSTATS_CMD_ATTR_PID] = { .type = NLA_U32 },
52 [TASKSTATS_CMD_ATTR_TGID] = { .type = NLA_U32 }, 51 [TASKSTATS_CMD_ATTR_TGID] = { .type = NLA_U32 },
53 [TASKSTATS_CMD_ATTR_REGISTER_CPUMASK] = { .type = NLA_STRING }, 52 [TASKSTATS_CMD_ATTR_REGISTER_CPUMASK] = { .type = NLA_STRING },
54 [TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK] = { .type = NLA_STRING },}; 53 [TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK] = { .type = NLA_STRING },};
55 54
56static struct nla_policy 55static const struct nla_policy cgroupstats_cmd_get_policy[CGROUPSTATS_CMD_ATTR_MAX+1] = {
57cgroupstats_cmd_get_policy[CGROUPSTATS_CMD_ATTR_MAX+1] __read_mostly = {
58 [CGROUPSTATS_CMD_ATTR_FD] = { .type = NLA_U32 }, 56 [CGROUPSTATS_CMD_ATTR_FD] = { .type = NLA_U32 },
59}; 57};
60 58
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 13700833c181..1f663d23e85e 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -453,6 +453,18 @@ static inline int clocksource_watchdog_kthread(void *data) { return 0; }
453#endif /* CONFIG_CLOCKSOURCE_WATCHDOG */ 453#endif /* CONFIG_CLOCKSOURCE_WATCHDOG */
454 454
455/** 455/**
456 * clocksource_suspend - suspend the clocksource(s)
457 */
458void clocksource_suspend(void)
459{
460 struct clocksource *cs;
461
462 list_for_each_entry_reverse(cs, &clocksource_list, list)
463 if (cs->suspend)
464 cs->suspend(cs);
465}
466
467/**
456 * clocksource_resume - resume the clocksource(s) 468 * clocksource_resume - resume the clocksource(s)
457 */ 469 */
458void clocksource_resume(void) 470void clocksource_resume(void)
@@ -461,7 +473,7 @@ void clocksource_resume(void)
461 473
462 list_for_each_entry(cs, &clocksource_list, list) 474 list_for_each_entry(cs, &clocksource_list, list)
463 if (cs->resume) 475 if (cs->resume)
464 cs->resume(); 476 cs->resume(cs);
465 477
466 clocksource_resume_watchdog(); 478 clocksource_resume_watchdog();
467} 479}
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 4800f933910e..7c0f180d6e9d 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -58,10 +58,10 @@ static s64 time_offset;
58static long time_constant = 2; 58static long time_constant = 2;
59 59
60/* maximum error (usecs): */ 60/* maximum error (usecs): */
61long time_maxerror = NTP_PHASE_LIMIT; 61static long time_maxerror = NTP_PHASE_LIMIT;
62 62
63/* estimated error (usecs): */ 63/* estimated error (usecs): */
64long time_esterror = NTP_PHASE_LIMIT; 64static long time_esterror = NTP_PHASE_LIMIT;
65 65
66/* frequency offset (scaled nsecs/secs): */ 66/* frequency offset (scaled nsecs/secs): */
67static s64 time_freq; 67static s64 time_freq;
@@ -142,11 +142,11 @@ static void ntp_update_offset(long offset)
142 * Select how the frequency is to be controlled 142 * Select how the frequency is to be controlled
143 * and in which mode (PLL or FLL). 143 * and in which mode (PLL or FLL).
144 */ 144 */
145 secs = xtime.tv_sec - time_reftime; 145 secs = get_seconds() - time_reftime;
146 if (unlikely(time_status & STA_FREQHOLD)) 146 if (unlikely(time_status & STA_FREQHOLD))
147 secs = 0; 147 secs = 0;
148 148
149 time_reftime = xtime.tv_sec; 149 time_reftime = get_seconds();
150 150
151 offset64 = offset; 151 offset64 = offset;
152 freq_adj = (offset64 * secs) << 152 freq_adj = (offset64 * secs) <<
@@ -368,7 +368,7 @@ static inline void process_adj_status(struct timex *txc, struct timespec *ts)
368 * reference time to current time. 368 * reference time to current time.
369 */ 369 */
370 if (!(time_status & STA_PLL) && (txc->status & STA_PLL)) 370 if (!(time_status & STA_PLL) && (txc->status & STA_PLL))
371 time_reftime = xtime.tv_sec; 371 time_reftime = get_seconds();
372 372
373 /* only set allowed bits */ 373 /* only set allowed bits */
374 time_status &= STA_RONLY; 374 time_status &= STA_RONLY;
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index e2ab064c6d41..16736379a9ca 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -622,6 +622,7 @@ static int timekeeping_suspend(struct sys_device *dev, pm_message_t state)
622 write_sequnlock_irqrestore(&xtime_lock, flags); 622 write_sequnlock_irqrestore(&xtime_lock, flags);
623 623
624 clockevents_notify(CLOCK_EVT_NOTIFY_SUSPEND, NULL); 624 clockevents_notify(CLOCK_EVT_NOTIFY_SUSPEND, NULL);
625 clocksource_suspend();
625 626
626 return 0; 627 return 0;
627} 628}
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index d9d6206e0b14..07f945a99430 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -540,9 +540,10 @@ int blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
540 if (ret) 540 if (ret)
541 return ret; 541 return ret;
542 542
543 if (copy_to_user(arg, &buts, sizeof(buts))) 543 if (copy_to_user(arg, &buts, sizeof(buts))) {
544 blk_trace_remove(q);
544 return -EFAULT; 545 return -EFAULT;
545 546 }
546 return 0; 547 return 0;
547} 548}
548EXPORT_SYMBOL_GPL(blk_trace_setup); 549EXPORT_SYMBOL_GPL(blk_trace_setup);