Skip to content

Commit f6d026e

Browse files
sunlimingrostedt
authored andcommitted
tracing/user_events: Fix incorrect return value for writing operation when events are disabled
The writing operation return the count of writes regardless of whether events are enabled or disabled. Switch it to return -EBADF to indicates that the event is disabled. Link: https://lkml.kernel.org/r/20230626111344.19136-2-sunliming@kylinos.cn Cc: stable@vger.kernel.org 7f5a08c ("user_events: Add minimal support for trace_event into ftrace") Acked-by: Beau Belgrave <beaub@linux.microsoft.com> Signed-off-by: sunliming <sunliming@kylinos.cn> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent 0113d46 commit f6d026e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

kernel/trace/trace_events_user.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2096,7 +2096,8 @@ static ssize_t user_events_write_core(struct file *file, struct iov_iter *i)
20962096

20972097
if (unlikely(faulted))
20982098
return -EFAULT;
2099-
}
2099+
} else
2100+
return -EBADF;
21002101

21012102
return ret;
21022103
}

0 commit comments

Comments
 (0)