Skip to content

Commit

Permalink
ring-buffer: Move resize integrity check under reader lock
Browse files Browse the repository at this point in the history
While using an application that does splice on the ftrace ring
buffer at start up, I triggered an integrity check failure.

Looking into this, I discovered that resizing the buffer performs
an integrity check after the buffer is resized. This check unfortunately
is preformed after it releases the reader lock. If a reader is
reading the buffer it may cause the integrity check to trigger a
false failure.

This patch simply moves the integrity checker under the protection
of the ring buffer reader lock.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed Dec 11, 2009
1 parent 1842101 commit dd7f594
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kernel/trace/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1208,9 +1208,9 @@ rb_remove_pages(struct ring_buffer_per_cpu *cpu_buffer, unsigned nr_pages)
return;

rb_reset_cpu(cpu_buffer);
spin_unlock_irq(&cpu_buffer->reader_lock);

rb_check_pages(cpu_buffer);

spin_unlock_irq(&cpu_buffer->reader_lock);
}

static void
Expand All @@ -1233,9 +1233,9 @@ rb_insert_pages(struct ring_buffer_per_cpu *cpu_buffer,
list_add_tail(&bpage->list, cpu_buffer->pages);
}
rb_reset_cpu(cpu_buffer);
spin_unlock_irq(&cpu_buffer->reader_lock);

rb_check_pages(cpu_buffer);

spin_unlock_irq(&cpu_buffer->reader_lock);
}

/**
Expand Down

0 comments on commit dd7f594

Please sign in to comment.