[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-88d4f0db7fa8785859c1d637f9aac210932b6216@git.kernel.org>
Date: Thu, 27 Jan 2011 18:28:04 GMT
From: tip-bot for Eric Dumazet <eric.dumazet@...il.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, eranian@...gle.com, acme@...hat.com,
hpa@...or.com, mingo@...hat.com, eric.dumazet@...il.com,
a.p.zijlstra@...llo.nl, davem@...emloft.net, fweisbec@...il.com,
tglx@...utronix.de, mingo@...e.hu
Subject: [tip:perf/urgent] perf: Fix alloc_callchain_buffers()
Commit-ID: 88d4f0db7fa8785859c1d637f9aac210932b6216
Gitweb: http://git.kernel.org/tip/88d4f0db7fa8785859c1d637f9aac210932b6216
Author: Eric Dumazet <eric.dumazet@...il.com>
AuthorDate: Tue, 25 Jan 2011 19:40:51 +0100
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Thu, 27 Jan 2011 19:21:50 +0100
perf: Fix alloc_callchain_buffers()
Commit 927c7a9e92c4 ("perf: Fix race in callchains") introduced
a mismatch in the sizing of struct callchain_cpus_entries.
nr_cpu_ids must be used instead of num_possible_cpus(), or we
might get out of bound memory accesses on some machines.
Signed-off-by: Eric Dumazet <eric.dumazet@...il.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: David Miller <davem@...emloft.net>
Cc: Stephane Eranian <eranian@...gle.com>
CC: stable@...nel.org
LKML-Reference: <1295980851.3588.351.camel@...mazet-laptop>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
kernel/perf_event.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 126a302..852ae8c 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1999,8 +1999,7 @@ static int alloc_callchain_buffers(void)
* accessed from NMI. Use a temporary manual per cpu allocation
* until that gets sorted out.
*/
- size = sizeof(*entries) + sizeof(struct perf_callchain_entry *) *
- num_possible_cpus();
+ size = offsetof(struct callchain_cpus_entries, cpu_entries[nr_cpu_ids]);
entries = kzalloc(size, GFP_KERNEL);
if (!entries)
--
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