]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ring-buffer: Fix to update per-subbuf entries of persistent ring buffer
authorMasami Hiramatsu (Google) <mhiramat@kernel.org>
Thu, 19 Mar 2026 09:12:19 +0000 (18:12 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Mar 2026 10:08:56 +0000 (11:08 +0100)
commit f35dbac6942171dc4ce9398d1d216a59224590a9 upstream.

Since the validation loop in rb_meta_validate_events() updates the same
cpu_buffer->head_page->entries, the other subbuf entries are not updated.
Fix to use head_page to update the entries field, since it is the cursor
in this loop.

Cc: stable@vger.kernel.org
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Ian Rogers <irogers@google.com>
Fixes: 5f3b6e839f3c ("ring-buffer: Validate boot range memory events")
Link: https://patch.msgid.link/177391153882.193994.17158784065013676533.stgit@mhiramat.tok.corp.google.com
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/trace/ring_buffer.c

index 6958ae79464d74345dd9944e5daee14dc9f4c785..ccfaae8795f0096d58f8b52699b64587fe2e60dc 100644 (file)
@@ -1863,7 +1863,7 @@ static void rb_meta_validate_events(struct ring_buffer_per_cpu *cpu_buffer)
 
                entries += ret;
                entry_bytes += local_read(&head_page->page->commit);
-               local_set(&cpu_buffer->head_page->entries, ret);
+               local_set(&head_page->entries, ret);
 
                if (head_page == cpu_buffer->commit_page)
                        break;