[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1349986271.24256.67.camel@gandalf.local.home>
Date: Thu, 11 Oct 2012 16:11:11 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: LKML <linux-kernel@...r.kernel.org>
Cc: Ingo Molnar <mingo@...nel.org>, stable <stable@...r.kernel.org>,
Vaibhav Nagarnaik <vnagarnaik@...gle.com>
Subject: [PATCH][3.7] ring-buffer: Check for uninitialized cpu buffer before
resizing
Ingo,
Please pull the latest tip/perf/urgent tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
tip/perf/urgent
Head SHA1: 8e49f418c9632790bf456634742d34d97120a784
Vaibhav Nagarnaik (1):
ring-buffer: Check for uninitialized cpu buffer before resizing
----
kernel/trace/ring_buffer.c | 4 ++++
1 file changed, 4 insertions(+)
---------------------------
commit 8e49f418c9632790bf456634742d34d97120a784
Author: Vaibhav Nagarnaik <vnagarnaik@...gle.com>
Date: Wed Oct 10 16:40:27 2012 -0700
ring-buffer: Check for uninitialized cpu buffer before resizing
With a system where, num_present_cpus < num_possible_cpus, even if all
CPUs are online, non-present CPUs don't have per_cpu buffers allocated.
If per_cpu/<cpu>/buffer_size_kb is modified for such a CPU, it can cause
a panic due to NULL dereference in ring_buffer_resize().
To fix this, resize operation is allowed only if the per-cpu buffer has
been initialized.
Link: http://lkml.kernel.org/r/1349912427-6486-1-git-send-email-vnagarnaik@google.com
Cc: stable@...r.kernel.org # 3.5+
Signed-off-by: Vaibhav Nagarnaik <vnagarnaik@...gle.com>
Signed-off-by: Steven Rostedt <rostedt@...dmis.org>
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index b32ed0e..b979426 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -1567,6 +1567,10 @@ int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size,
put_online_cpus();
} else {
+ /* Make sure this CPU has been intitialized */
+ if (!cpumask_test_cpu(cpu_id, buffer->cpumask))
+ goto out;
+
cpu_buffer = buffer->buffers[cpu_id];
if (nr_pages == cpu_buffer->nr_pages)
--
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