Commit 6721cb60 authored by Steven Rostedt (Red Hat)'s avatar Steven Rostedt (Red Hat) Committed by Steven Rostedt

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: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent ca164318
...@@ -620,6 +620,9 @@ int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu, ...@@ -620,6 +620,9 @@ int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu,
if (cpu == RING_BUFFER_ALL_CPUS) if (cpu == RING_BUFFER_ALL_CPUS)
work = &buffer->irq_work; work = &buffer->irq_work;
else { else {
if (!cpumask_test_cpu(cpu, buffer->cpumask))
return -EINVAL;
cpu_buffer = buffer->buffers[cpu]; cpu_buffer = buffer->buffers[cpu];
work = &cpu_buffer->irq_work; work = &cpu_buffer->irq_work;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment