summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2023-06-30 02:36:00 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2023-06-30 02:36:00 +0200
commit3ad7b12c72ae6ba34d452e88a60c37c9fb368fbb (patch)
treecb547c351c74d2a133ae430f9f2dc80b31be6e9d /kernel
parentMerge tag 'acpi-6.5-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/r... (diff)
parentselftests/user_events: Add test cases when event is disabled (diff)
downloadlinux-3ad7b12c72ae6ba34d452e88a60c37c9fb368fbb.tar.xz
linux-3ad7b12c72ae6ba34d452e88a60c37c9fb368fbb.zip
Merge tag 'trace-v6.4-rc7-v3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull tracing fix from Steven Rostedt: "Fix user event write on buffer disabled. The user events write currently returns the size of what was supposed to be written when tracing is disabled and nothing was written. Instead, behave like trace_marker and return -EBADF, as that is what is returned if a file is opened for read only, and a write is performed on it. Writing to the buffer that is disabled is like trying to write to a file opened for read only, as the buffer still can be read, but just not written to. This also includes test cases for this use case" * tag 'trace-v6.4-rc7-v3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: selftests/user_events: Add test cases when event is disabled selftests/user_events: Enable the event before write_fault test in ftrace self-test tracing/user_events: Fix incorrect return value for writing operation when events are disabled
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace_events_user.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
index 0536db7fef61..4f5e74bbdab2 100644
--- a/kernel/trace/trace_events_user.c
+++ b/kernel/trace/trace_events_user.c
@@ -2096,7 +2096,8 @@ static ssize_t user_events_write_core(struct file *file, struct iov_iter *i)
if (unlikely(faulted))
return -EFAULT;
- }
+ } else
+ return -EBADF;
return ret;
}