]> www.infradead.org Git - nvme.git/commit
ring-buffer: Fix refcount setting of boot mapped buffers
authorSteven Rostedt <rostedt@goodmis.org>
Fri, 11 Oct 2024 20:52:24 +0000 (16:52 -0400)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Mon, 14 Oct 2024 18:30:59 +0000 (14:30 -0400)
commit2cf9733891a460a16a209fcc20fbd138605b13b8
tree5dec4b773cb8e37ce429685efb1e8288f59c8318
parent912da2c384d510ce40c5af9c3adc316afa4ec547
ring-buffer: Fix refcount setting of boot mapped buffers

A ring buffer which has its buffered mapped at boot up to fixed memory
should not be freed. Other buffers can be. The ref counting setup was
wrong for both. It made the not mapped buffers ref count have zero, and the
boot mapped buffer a ref count of 1. But an normally allocated buffer
should be 1, where it can be removed.

Keep the ref count of a normal boot buffer with its setup ref count (do
not decrement it), and increment the fixed memory boot mapped buffer's ref
count.

Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://lore.kernel.org/20241011165224.33dd2624@gandalf.local.home
Fixes: e645535a954ad ("tracing: Add option to use memmapped memory for trace boot instance")
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/trace.c