]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ring-buffer: Unlock resize on mmap error
authorSteven Rostedt <rostedt@goodmis.org>
Thu, 13 Feb 2025 18:19:57 +0000 (13:19 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Feb 2025 13:01:29 +0000 (14:01 +0100)
commit 9ba0e1755a40f9920ad0f4168031291b3eb58d7b upstream.

Memory mapping the tracing ring buffer will disable resizing the buffer.
But if there's an error in the memory mapping like an invalid parameter,
the function exits out without re-enabling the resizing of the ring
buffer, preventing the ring buffer from being resized after that.

Cc: stable@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Vincent Donnefort <vdonnefort@google.com>
Link: https://lore.kernel.org/20250213131957.530ec3c5@gandalf.local.home
Fixes: 117c39200d9d7 ("ring-buffer: Introducing ring-buffer mapping functions")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/trace/ring_buffer.c

index 0f8f3ffc6f09046c52374366ffc43f52ca383dee..e4bfab9777b39937e73b593b1f4e74c3e7df3dc5 100644 (file)
@@ -7157,6 +7157,7 @@ int ring_buffer_map(struct trace_buffer *buffer, int cpu,
                kfree(cpu_buffer->subbuf_ids);
                cpu_buffer->subbuf_ids = NULL;
                rb_free_meta_page(cpu_buffer);
+               atomic_dec(&cpu_buffer->resize_disabled);
        }
 
 unlock: