diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2013-05-23 20:21:36 +0200 |
---|---|---|
committer | Steven Rostedt <rostedt@rostedt.homelinux.com> | 2013-05-28 16:53:20 +0200 |
commit | 6721cb60022629ae76365551f05d9658b8d14c55 (patch) | |
tree | 00d16ebb628161995b02939460d3f7b8d0f5ac53 /kernel/trace/ring_buffer.c | |
parent | tracing: Fix crash when ftrace=nop on the kernel command line (diff) | |
download | linux-6721cb60022629ae76365551f05d9658b8d14c55.tar.xz linux-6721cb60022629ae76365551f05d9658b8d14c55.zip |
ring-buffer: Do not poll non allocated cpu buffers
The tracing infrastructure sets up for possible CPUs, but it uses
the ring buffer polling, it is possible to call the ring buffer
polling code with a CPU that hasn't been allocated. This will cause
a kernel oops when it access a ring buffer cpu buffer that is part
of the possible cpus but hasn't been allocated yet as the CPU has never
been online.
Reported-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/ring_buffer.c')
-rw-r--r-- | kernel/trace/ring_buffer.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index b59aea2c48c2..e444ff88f0a4 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -620,6 +620,9 @@ int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu, if (cpu == RING_BUFFER_ALL_CPUS) work = &buffer->irq_work; else { + if (!cpumask_test_cpu(cpu, buffer->cpumask)) + return -EINVAL; + cpu_buffer = buffer->buffers[cpu]; work = &cpu_buffer->irq_work; } |