diff options
author | Tan Xiaojun <tanxiaojun@huawei.com> | 2017-02-23 14:04:39 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-05-16 10:05:14 +0200 |
commit | 2e9cbae49c5d3e69ca04510d68ae161374e5d0a2 (patch) | |
tree | 9f806fbdbabf7acc0c66895b0dcdc2bf9d8b636b | |
parent | a88e99b14d1095064ebc74d58fee6efcc4098da6 (diff) | |
download | linux-stable-2e9cbae49c5d3e69ca04510d68ae161374e5d0a2.tar.gz linux-stable-2e9cbae49c5d3e69ca04510d68ae161374e5d0a2.tar.bz2 linux-stable-2e9cbae49c5d3e69ca04510d68ae161374e5d0a2.zip |
perf/core: Fix the perf_cpu_time_max_percent check
commit 1572e45a924f254d9570093abde46430c3172e3d upstream.
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>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | kernel/events/core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c index af2780655f5b..e97986c99ed7 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -224,7 +224,7 @@ int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { - int ret = proc_dointvec(table, write, buffer, lenp, ppos); + int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); if (ret || !write) return ret; |