diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/events/core.c | 19 | ||||
| -rw-r--r-- | kernel/fork.c | 7 | ||||
| -rw-r--r-- | kernel/params.c | 3 | ||||
| -rw-r--r-- | kernel/pid.c | 4 | ||||
| -rw-r--r-- | kernel/relay.c | 10 |
5 files changed, 31 insertions, 12 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c index ba36013cfb21..1b5c081d8b9f 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
| @@ -2303,7 +2303,7 @@ do { \ | |||
| 2303 | static DEFINE_PER_CPU(int, perf_throttled_count); | 2303 | static DEFINE_PER_CPU(int, perf_throttled_count); |
| 2304 | static DEFINE_PER_CPU(u64, perf_throttled_seq); | 2304 | static DEFINE_PER_CPU(u64, perf_throttled_seq); |
| 2305 | 2305 | ||
| 2306 | static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count) | 2306 | static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count, bool disable) |
| 2307 | { | 2307 | { |
| 2308 | struct hw_perf_event *hwc = &event->hw; | 2308 | struct hw_perf_event *hwc = &event->hw; |
| 2309 | s64 period, sample_period; | 2309 | s64 period, sample_period; |
| @@ -2322,9 +2322,13 @@ static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count) | |||
| 2322 | hwc->sample_period = sample_period; | 2322 | hwc->sample_period = sample_period; |
| 2323 | 2323 | ||
| 2324 | if (local64_read(&hwc->period_left) > 8*sample_period) { | 2324 | if (local64_read(&hwc->period_left) > 8*sample_period) { |
| 2325 | event->pmu->stop(event, PERF_EF_UPDATE); | 2325 | if (disable) |
| 2326 | event->pmu->stop(event, PERF_EF_UPDATE); | ||
| 2327 | |||
| 2326 | local64_set(&hwc->period_left, 0); | 2328 | local64_set(&hwc->period_left, 0); |
| 2327 | event->pmu->start(event, PERF_EF_RELOAD); | 2329 | |
| 2330 | if (disable) | ||
| 2331 | event->pmu->start(event, PERF_EF_RELOAD); | ||
| 2328 | } | 2332 | } |
| 2329 | } | 2333 | } |
| 2330 | 2334 | ||
| @@ -2350,6 +2354,7 @@ static void perf_adjust_freq_unthr_context(struct perf_event_context *ctx, | |||
| 2350 | return; | 2354 | return; |
| 2351 | 2355 | ||
| 2352 | raw_spin_lock(&ctx->lock); | 2356 | raw_spin_lock(&ctx->lock); |
| 2357 | perf_pmu_disable(ctx->pmu); | ||
| 2353 | 2358 | ||
| 2354 | list_for_each_entry_rcu(event, &ctx->event_list, event_entry) { | 2359 | list_for_each_entry_rcu(event, &ctx->event_list, event_entry) { |
| 2355 | if (event->state != PERF_EVENT_STATE_ACTIVE) | 2360 | if (event->state != PERF_EVENT_STATE_ACTIVE) |
| @@ -2381,13 +2386,17 @@ static void perf_adjust_freq_unthr_context(struct perf_event_context *ctx, | |||
| 2381 | /* | 2386 | /* |
| 2382 | * restart the event | 2387 | * restart the event |
| 2383 | * reload only if value has changed | 2388 | * reload only if value has changed |
| 2389 | * we have stopped the event so tell that | ||
| 2390 | * to perf_adjust_period() to avoid stopping it | ||
| 2391 | * twice. | ||
| 2384 | */ | 2392 | */ |
| 2385 | if (delta > 0) | 2393 | if (delta > 0) |
| 2386 | perf_adjust_period(event, period, delta); | 2394 | perf_adjust_period(event, period, delta, false); |
| 2387 | 2395 | ||
| 2388 | event->pmu->start(event, delta > 0 ? PERF_EF_RELOAD : 0); | 2396 | event->pmu->start(event, delta > 0 ? PERF_EF_RELOAD : 0); |
| 2389 | } | 2397 | } |
| 2390 | 2398 | ||
| 2399 | perf_pmu_enable(ctx->pmu); | ||
| 2391 | raw_spin_unlock(&ctx->lock); | 2400 | raw_spin_unlock(&ctx->lock); |
| 2392 | } | 2401 | } |
| 2393 | 2402 | ||
| @@ -4562,7 +4571,7 @@ static int __perf_event_overflow(struct perf_event *event, | |||
| 4562 | hwc->freq_time_stamp = now; | 4571 | hwc->freq_time_stamp = now; |
| 4563 | 4572 | ||
| 4564 | if (delta > 0 && delta < 2*TICK_NSEC) | 4573 | if (delta > 0 && delta < 2*TICK_NSEC) |
| 4565 | perf_adjust_period(event, delta, hwc->last_period); | 4574 | perf_adjust_period(event, delta, hwc->last_period, true); |
| 4566 | } | 4575 | } |
| 4567 | 4576 | ||
| 4568 | /* | 4577 | /* |
diff --git a/kernel/fork.c b/kernel/fork.c index 1b2ef3c23ae4..e2cd3e2a5ae8 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
| @@ -66,6 +66,7 @@ | |||
| 66 | #include <linux/user-return-notifier.h> | 66 | #include <linux/user-return-notifier.h> |
| 67 | #include <linux/oom.h> | 67 | #include <linux/oom.h> |
| 68 | #include <linux/khugepaged.h> | 68 | #include <linux/khugepaged.h> |
| 69 | #include <linux/signalfd.h> | ||
| 69 | 70 | ||
| 70 | #include <asm/pgtable.h> | 71 | #include <asm/pgtable.h> |
| 71 | #include <asm/pgalloc.h> | 72 | #include <asm/pgalloc.h> |
| @@ -910,7 +911,7 @@ static int copy_io(unsigned long clone_flags, struct task_struct *tsk) | |||
| 910 | return -ENOMEM; | 911 | return -ENOMEM; |
| 911 | 912 | ||
| 912 | new_ioc->ioprio = ioc->ioprio; | 913 | new_ioc->ioprio = ioc->ioprio; |
| 913 | put_io_context(new_ioc, NULL); | 914 | put_io_context(new_ioc); |
| 914 | } | 915 | } |
| 915 | #endif | 916 | #endif |
| 916 | return 0; | 917 | return 0; |
| @@ -935,8 +936,10 @@ static int copy_sighand(unsigned long clone_flags, struct task_struct *tsk) | |||
| 935 | 936 | ||
| 936 | void __cleanup_sighand(struct sighand_struct *sighand) | 937 | void __cleanup_sighand(struct sighand_struct *sighand) |
| 937 | { | 938 | { |
| 938 | if (atomic_dec_and_test(&sighand->count)) | 939 | if (atomic_dec_and_test(&sighand->count)) { |
| 940 | signalfd_cleanup(sighand); | ||
| 939 | kmem_cache_free(sighand_cachep, sighand); | 941 | kmem_cache_free(sighand_cachep, sighand); |
| 942 | } | ||
| 940 | } | 943 | } |
| 941 | 944 | ||
| 942 | 945 | ||
diff --git a/kernel/params.c b/kernel/params.c index 32ee04308285..4bc965d8a1fe 100644 --- a/kernel/params.c +++ b/kernel/params.c | |||
| @@ -97,7 +97,8 @@ static int parse_one(char *param, | |||
| 97 | for (i = 0; i < num_params; i++) { | 97 | for (i = 0; i < num_params; i++) { |
| 98 | if (parameq(param, params[i].name)) { | 98 | if (parameq(param, params[i].name)) { |
| 99 | /* No one handled NULL, so do it here. */ | 99 | /* No one handled NULL, so do it here. */ |
| 100 | if (!val && params[i].ops->set != param_set_bool) | 100 | if (!val && params[i].ops->set != param_set_bool |
| 101 | && params[i].ops->set != param_set_bint) | ||
| 101 | return -EINVAL; | 102 | return -EINVAL; |
| 102 | pr_debug("They are equal! Calling %p\n", | 103 | pr_debug("They are equal! Calling %p\n", |
| 103 | params[i].ops->set); | 104 | params[i].ops->set); |
diff --git a/kernel/pid.c b/kernel/pid.c index ce8e00deaccb..9f08dfabaf13 100644 --- a/kernel/pid.c +++ b/kernel/pid.c | |||
| @@ -543,12 +543,12 @@ struct pid *find_ge_pid(int nr, struct pid_namespace *ns) | |||
| 543 | */ | 543 | */ |
| 544 | void __init pidhash_init(void) | 544 | void __init pidhash_init(void) |
| 545 | { | 545 | { |
| 546 | int i, pidhash_size; | 546 | unsigned int i, pidhash_size; |
| 547 | 547 | ||
| 548 | pid_hash = alloc_large_system_hash("PID", sizeof(*pid_hash), 0, 18, | 548 | pid_hash = alloc_large_system_hash("PID", sizeof(*pid_hash), 0, 18, |
| 549 | HASH_EARLY | HASH_SMALL, | 549 | HASH_EARLY | HASH_SMALL, |
| 550 | &pidhash_shift, NULL, 4096); | 550 | &pidhash_shift, NULL, 4096); |
| 551 | pidhash_size = 1 << pidhash_shift; | 551 | pidhash_size = 1U << pidhash_shift; |
| 552 | 552 | ||
| 553 | for (i = 0; i < pidhash_size; i++) | 553 | for (i = 0; i < pidhash_size; i++) |
| 554 | INIT_HLIST_HEAD(&pid_hash[i]); | 554 | INIT_HLIST_HEAD(&pid_hash[i]); |
diff --git a/kernel/relay.c b/kernel/relay.c index 4335e1d7ee2d..ab56a1764d4d 100644 --- a/kernel/relay.c +++ b/kernel/relay.c | |||
| @@ -164,10 +164,14 @@ depopulate: | |||
| 164 | */ | 164 | */ |
| 165 | static struct rchan_buf *relay_create_buf(struct rchan *chan) | 165 | static struct rchan_buf *relay_create_buf(struct rchan *chan) |
| 166 | { | 166 | { |
| 167 | struct rchan_buf *buf = kzalloc(sizeof(struct rchan_buf), GFP_KERNEL); | 167 | struct rchan_buf *buf; |
| 168 | if (!buf) | 168 | |
| 169 | if (chan->n_subbufs > UINT_MAX / sizeof(size_t *)) | ||
| 169 | return NULL; | 170 | return NULL; |
| 170 | 171 | ||
| 172 | buf = kzalloc(sizeof(struct rchan_buf), GFP_KERNEL); | ||
| 173 | if (!buf) | ||
| 174 | return NULL; | ||
| 171 | buf->padding = kmalloc(chan->n_subbufs * sizeof(size_t *), GFP_KERNEL); | 175 | buf->padding = kmalloc(chan->n_subbufs * sizeof(size_t *), GFP_KERNEL); |
| 172 | if (!buf->padding) | 176 | if (!buf->padding) |
| 173 | goto free_buf; | 177 | goto free_buf; |
| @@ -574,6 +578,8 @@ struct rchan *relay_open(const char *base_filename, | |||
| 574 | 578 | ||
| 575 | if (!(subbuf_size && n_subbufs)) | 579 | if (!(subbuf_size && n_subbufs)) |
| 576 | return NULL; | 580 | return NULL; |
| 581 | if (subbuf_size > UINT_MAX / n_subbufs) | ||
| 582 | return NULL; | ||
| 577 | 583 | ||
| 578 | chan = kzalloc(sizeof(struct rchan), GFP_KERNEL); | 584 | chan = kzalloc(sizeof(struct rchan), GFP_KERNEL); |
| 579 | if (!chan) | 585 | if (!chan) |
