[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1394029455-23128-67-git-send-email-luis.henriques@canonical.com>
Date: Wed, 5 Mar 2014 14:23:10 +0000
From: Luis Henriques <luis.henriques@...onical.com>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
kernel-team@...ts.ubuntu.com
Cc: Knut Petersen <Knut_Petersen@...nline.de>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>,
Weng Meiling <wengmeiling.weng@...wei.com>,
Luis Henriques <luis.henriques@...onical.com>
Subject: [PATCH 3.11 066/131] perf: Enforce 1 as lower limit for perf_event_max_sample_rate
3.11.10.6 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Knut Petersen <Knut_Petersen@...nline.de>
commit 723478c8a471403c53cf144999701f6e0c4bbd11 upstream.
/proc/sys/kernel/perf_event_max_sample_rate will accept
negative values as well as 0.
Negative values are unreasonable, and 0 causes a
divide by zero exception in perf_proc_update_handler.
This patch enforces a lower limit of 1.
Signed-off-by: Knut Petersen <Knut_Petersen@...nline.de>
Signed-off-by: Peter Zijlstra <peterz@...radead.org>
Link: http://lkml.kernel.org/r/5242DB0C.4070005@t-online.de
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Cc: Weng Meiling <wengmeiling.weng@...wei.com>
Signed-off-by: Luis Henriques <luis.henriques@...onical.com>
---
kernel/events/core.c | 2 +-
kernel/sysctl.c | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index f86599e..fc645f1 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -192,7 +192,7 @@ int perf_proc_update_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;
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 07f6fc4..f252045 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1049,6 +1049,7 @@ static struct ctl_table kern_table[] = {
.maxlen = sizeof(sysctl_perf_event_sample_rate),
.mode = 0644,
.proc_handler = perf_proc_update_handler,
+ .extra1 = &one,
},
{
.procname = "perf_cpu_time_max_percent",
--
1.9.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists