mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
ring-buffer: Fix buffer locking in ring_buffer_subbuf_order_set()
Enlarge the critical section in ring_buffer_subbuf_order_set() to
ensure that error handling takes place with per-buffer mutex held,
thus preventing list corruption and other concurrency-related issues.
Cc: stable@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Tzvetomir Stoyanov <tz.stoyanov@gmail.com>
Link: https://lore.kernel.org/20250606112242.1510605-1-dmantipov@yandex.ru
Reported-by: syzbot+05d673e83ec640f0ced9@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=05d673e83ec640f0ced9
Fixes: f9b94daa54
("ring-buffer: Set new size of the ring buffer sub page")
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
This commit is contained in:
parent
a9d0aab5eb
commit
40ee2afafc
1 changed files with 1 additions and 3 deletions
|
@ -6795,7 +6795,7 @@ int ring_buffer_subbuf_order_set(struct trace_buffer *buffer, int order)
|
|||
old_size = buffer->subbuf_size;
|
||||
|
||||
/* prevent another thread from changing buffer sizes */
|
||||
mutex_lock(&buffer->mutex);
|
||||
guard(mutex)(&buffer->mutex);
|
||||
atomic_inc(&buffer->record_disabled);
|
||||
|
||||
/* Make sure all commits have finished */
|
||||
|
@ -6900,7 +6900,6 @@ int ring_buffer_subbuf_order_set(struct trace_buffer *buffer, int order)
|
|||
}
|
||||
|
||||
atomic_dec(&buffer->record_disabled);
|
||||
mutex_unlock(&buffer->mutex);
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -6909,7 +6908,6 @@ error:
|
|||
buffer->subbuf_size = old_size;
|
||||
|
||||
atomic_dec(&buffer->record_disabled);
|
||||
mutex_unlock(&buffer->mutex);
|
||||
|
||||
for_each_buffer_cpu(buffer, cpu) {
|
||||
cpu_buffer = buffer->buffers[cpu];
|
||||
|
|
Loading…
Add table
Reference in a new issue