4.19-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Masami Hiramatsu <[email protected]>

commit 18858511fd8a877303cc34c06efa461b26a0e070 upstream.

Return -ENOENT error if there is no target synthetic event.
This notices an operation failure to user as below;

  # echo 'wakeup_latency u64 lat; pid_t pid;' > synthetic_events
  # echo '!wakeup' >> synthetic_events
  sh: write error: No such file or directory

Link: 
http://lkml.kernel.org/r/154013449986.25576.9487131386597290172.stgit@devbox

Acked-by: Tom Zanussi <[email protected]>
Tested-by: Tom Zanussi <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: Rajvi Jingar <[email protected]>
Cc: [email protected]
Fixes: 4b147936fa50 ('tracing: Add support for 'synthetic' events')
Signed-off-by: Masami Hiramatsu <[email protected]>
Signed-off-by: Steven Rostedt (VMware) <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 kernel/trace/trace_events_hist.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -1063,8 +1063,10 @@ static int create_synth_event(int argc,
                event = NULL;
                ret = -EEXIST;
                goto out;
-       } else if (delete_event)
+       } else if (delete_event) {
+               ret = -ENOENT;
                goto out;
+       }
 
        if (argc < 2) {
                ret = -EINVAL;


Reply via email to