1 From f6d026eea390d59787a6cdc2ef5c983d02e029d0 Mon Sep 17 00:00:00 2001
2 From: sunliming <sunliming@kylinos.cn>
3 Date: Mon, 26 Jun 2023 19:13:42 +0800
4 Subject: tracing/user_events: Fix incorrect return value for writing operation when events are disabled
6 From: sunliming <sunliming@kylinos.cn>
8 commit f6d026eea390d59787a6cdc2ef5c983d02e029d0 upstream.
10 The writing operation return the count of writes regardless of whether events
11 are enabled or disabled. Switch it to return -EBADF to indicates that the event
14 Link: https://lkml.kernel.org/r/20230626111344.19136-2-sunliming@kylinos.cn
16 Cc: stable@vger.kernel.org
17 7f5a08c79df35 ("user_events: Add minimal support for trace_event into ftrace")
18 Acked-by: Beau Belgrave <beaub@linux.microsoft.com>
19 Signed-off-by: sunliming <sunliming@kylinos.cn>
20 Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23 kernel/trace/trace_events_user.c | 3 ++-
24 1 file changed, 2 insertions(+), 1 deletion(-)
26 --- a/kernel/trace/trace_events_user.c
27 +++ b/kernel/trace/trace_events_user.c
28 @@ -1456,7 +1456,8 @@ static ssize_t user_events_write_core(st
30 if (unlikely(faulted))