Skip to content

Commit 308f7ee

Browse files
Steven Rostedtrostedt
authored andcommitted
ring-buffer: Reset head page before running self test
When the ring buffer does its consistency test on itself, it removes the head page, runs the tests, and then adds it back to what the "head_page" pointer was. But because the head_page pointer may lack behind the real head page (held by the link list pointer). The reset may be incorrect. Instead, if the head_page exists (it does not on first allocation) reset it back to the real head page before running the consistency tests. Then it will be put back to its original location after the tests are complete. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 parent 659f451 commit 308f7ee

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

kernel/trace/ring_buffer.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,10 @@ static int rb_check_pages(struct ring_buffer_per_cpu *cpu_buffer)
945945
struct list_head *head = cpu_buffer->pages;
946946
struct buffer_page *bpage, *tmp;
947947

948+
/* Reset the head page if it exists */
949+
if (cpu_buffer->head_page)
950+
rb_set_head_page(cpu_buffer);
951+
948952
rb_head_page_deactivate(cpu_buffer);
949953

950954
if (RB_WARN_ON(cpu_buffer, head->next->prev != head))

0 commit comments

Comments
 (0)