summaryrefslogtreecommitdiffstats
path: root/kernel/events
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2019-02-04 08:45:42 +0100
committerIngo Molnar <mingo@kernel.org>2019-02-04 08:45:42 +0100
commit98cb621081705e2244ef6c265ff8a9f2208c7e2a (patch)
tree6205be47a83d54d3e35e049b67973244120f8bd6 /kernel/events
parentb844ff366f06a2bcecfbd053b4d4a472e670dec8 (diff)
parent9dff0aa95a324e262ffb03f425d00e4751f3294e (diff)
downloadlinux-98cb621081705e2244ef6c265ff8a9f2208c7e2a.tar.bz2
Merge branch 'perf/urgent' into perf/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/events')
-rw-r--r--kernel/events/core.c14
-rw-r--r--kernel/events/ring_buffer.c3
2 files changed, 10 insertions, 7 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 236bb8ddb7bc..280a72b3a553 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -438,18 +438,18 @@ int perf_proc_update_handler(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp,
loff_t *ppos)
{
- int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
-
- if (ret || !write)
- return ret;
-
+ int ret;
+ int perf_cpu = sysctl_perf_cpu_time_max_percent;
/*
* If throttling is disabled don't allow the write:
*/
- if (sysctl_perf_cpu_time_max_percent == 100 ||
- sysctl_perf_cpu_time_max_percent == 0)
+ if (write && (perf_cpu == 100 || perf_cpu == 0))
return -EINVAL;
+ ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
+ if (ret || !write)
+ return ret;
+
max_samples_per_tick = DIV_ROUND_UP(sysctl_perf_event_sample_rate, HZ);
perf_sample_period_ns = NSEC_PER_SEC / sysctl_perf_event_sample_rate;
update_perf_cpu_limits();
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
index 4a9937076331..309ef5a64af5 100644
--- a/kernel/events/ring_buffer.c
+++ b/kernel/events/ring_buffer.c
@@ -734,6 +734,9 @@ struct ring_buffer *rb_alloc(int nr_pages, long watermark, int cpu, int flags)
size = sizeof(struct ring_buffer);
size += nr_pages * sizeof(void *);
+ if (order_base_2(size) >= MAX_ORDER)
+ goto fail;
+
rb = kzalloc(size, GFP_KERNEL);
if (!rb)
goto fail;