Skip to content

Commit 1e6419b

Browse files
rostedtgregkh
authored andcommitted
tracing: Have the error of __tracing_resize_ring_buffer() passed to user
[ Upstream commit 60b8f71 ] Currently if __tracing_resize_ring_buffer() returns an error, the tracing_resize_ringbuffer() returns -ENOMEM. But it may not be a memory issue that caused the function to fail. If the ring buffer is memory mapped, then the resizing of the ring buffer will be disabled. But if the user tries to resize the buffer, it will get an -ENOMEM returned, which is confusing because there is plenty of memory. The actual error returned was -EBUSY, which would make much more sense to the user. Cc: stable@vger.kernel.org Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Vincent Donnefort <vdonnefort@google.com> Link: https://lore.kernel.org/20250213134132.7e4505d7@gandalf.local.home Fixes: 117c392 ("ring-buffer: Introducing ring-buffer mapping functions") Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 3284fbf commit 1e6419b

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

kernel/trace/trace.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5998,8 +5998,6 @@ static int __tracing_resize_ring_buffer(struct trace_array *tr,
59985998
ssize_t tracing_resize_ring_buffer(struct trace_array *tr,
59995999
unsigned long size, int cpu_id)
60006000
{
6001-
int ret;
6002-
60036001
guard(mutex)(&trace_types_lock);
60046002

60056003
if (cpu_id != RING_BUFFER_ALL_CPUS) {
@@ -6008,11 +6006,7 @@ ssize_t tracing_resize_ring_buffer(struct trace_array *tr,
60086006
return -EINVAL;
60096007
}
60106008

6011-
ret = __tracing_resize_ring_buffer(tr, size, cpu_id);
6012-
if (ret < 0)
6013-
ret = -ENOMEM;
6014-
6015-
return ret;
6009+
return __tracing_resize_ring_buffer(tr, size, cpu_id);
60166010
}
60176011

60186012
static void update_last_data(struct trace_array *tr)

0 commit comments

Comments
 (0)