提交 0e1ff5d7 编写于 作者: S Steven Rostedt 提交者: Steven Rostedt

ring-buffer: Add rb_list_head() wrapper around new reader page next field

If the very unlikely case happens where the writer moves the head by one
between where the head page is read and where the new reader page
is assigned _and_ the writer then writes and wraps the entire ring buffer
so that the head page is back to what was originally read as the head page,
the page to be swapped will have a corrupted next pointer.

Simple solution is to wrap the assignment of the next pointer with a
rb_list_head().
Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
上级 5ded3dc6
...@@ -2869,7 +2869,7 @@ rb_get_reader_page(struct ring_buffer_per_cpu *cpu_buffer) ...@@ -2869,7 +2869,7 @@ rb_get_reader_page(struct ring_buffer_per_cpu *cpu_buffer)
* Splice the empty reader page into the list around the head. * Splice the empty reader page into the list around the head.
*/ */
reader = rb_set_head_page(cpu_buffer); reader = rb_set_head_page(cpu_buffer);
cpu_buffer->reader_page->list.next = reader->list.next; cpu_buffer->reader_page->list.next = rb_list_head(reader->list.next);
cpu_buffer->reader_page->list.prev = reader->list.prev; cpu_buffer->reader_page->list.prev = reader->list.prev;
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册