Commit 8e49f418c9632790bf456634742d34d97120a784
Committed by
Steven Rostedt
1 parent
95cf59ea72
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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@vger.kernel.org # 3.5+ Signed-off-by: Vaibhav Nagarnaik <vnagarnaik@google.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Showing 1 changed file with 4 additions and 0 deletions Side-by-side Diff
kernel/trace/ring_buffer.c
... | ... | @@ -1567,6 +1567,10 @@ |
1567 | 1567 | |
1568 | 1568 | put_online_cpus(); |
1569 | 1569 | } else { |
1570 | + /* Make sure this CPU has been intitialized */ | |
1571 | + if (!cpumask_test_cpu(cpu_id, buffer->cpumask)) | |
1572 | + goto out; | |
1573 | + | |
1570 | 1574 | cpu_buffer = buffer->buffers[cpu_id]; |
1571 | 1575 | |
1572 | 1576 | if (nr_pages == cpu_buffer->nr_pages) |