Skip to content

Commit 1572e45

Browse files
t00214307Ingo Molnar
authored and
Ingo Molnar
committed
perf/core: Fix the perf_cpu_time_max_percent check
Use "proc_dointvec_minmax" instead of "proc_dointvec" to check the input value from user-space. If not, we can set a big value and some vars will overflow like "sysctl_perf_event_sample_rate" which will cause a lot of unexpected problems. Signed-off-by: Tan Xiaojun <tanxiaojun@huawei.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: <acme@kernel.org> Cc: <alexander.shishkin@linux.intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Vince Weaver <vincent.weaver@maine.edu> Link: http://lkml.kernel.org/r/1487829879-56237-1-git-send-email-tanxiaojun@huawei.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 7bbba0e commit 1572e45

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: kernel/events/core.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write,
455455
void __user *buffer, size_t *lenp,
456456
loff_t *ppos)
457457
{
458-
int ret = proc_dointvec(table, write, buffer, lenp, ppos);
458+
int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
459459

460460
if (ret || !write)
461461
return ret;

0 commit comments

Comments
 (0)