Skip to content

Commit 56f4ca0

Browse files
d-tatianinrostedt
authored andcommitted
ring_buffer: Do not deactivate non-existant pages
rb_head_page_deactivate() expects cpu_buffer to contain a valid list of ->pages, so verify that the list is actually present before calling it. Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool. Link: https://lkml.kernel.org/r/[email protected] Cc: [email protected] Fixes: 77ae365 ("ring-buffer: make lockless") Signed-off-by: Daniil Tatianin <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent bcea02b commit 56f4ca0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/trace/ring_buffer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1802,9 +1802,9 @@ static void rb_free_cpu_buffer(struct ring_buffer_per_cpu *cpu_buffer)
18021802

18031803
free_buffer_page(cpu_buffer->reader_page);
18041804

1805-
rb_head_page_deactivate(cpu_buffer);
1806-
18071805
if (head) {
1806+
rb_head_page_deactivate(cpu_buffer);
1807+
18081808
list_for_each_entry_safe(bpage, tmp, head, list) {
18091809
list_del_init(&bpage->list);
18101810
free_buffer_page(bpage);

0 commit comments

Comments
 (0)