Skip to content

Commit

Permalink
tracing/user_events: Fix incorrect return value for writing operation…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
sunliming authored and Steven Rostedt (Google) committed Jun 28, 2023
1 parent 0113d46 commit f6d026e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kernel/trace/trace_events_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit f6d026e

Please sign in to comment.