ftrace: Have ftrace_regex_write() return either read or error
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>
Thu, 9 May 2013 15:35:12 +0000 (11:35 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Thu, 9 May 2013 15:35:12 +0000 (11:35 -0400)
As ftrace_regex_write() reads the result of ftrace_process_regex()
which can sometimes return a positive number, only consider a
failure if the return is negative. Otherwise, it will skip possible
other registered probes and by returning a positive number that
wasn't read, it will confuse the user processes doing the writing.

Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/ftrace.c

index 8a5c017bb50c141bfca4d8206ac2a1805d224185..d85a0ad81a67ab5e0b20e2e6be941bd804c058bd 100644 (file)
@@ -3276,7 +3276,7 @@ ftrace_regex_write(struct file *file, const char __user *ubuf,
                ret = ftrace_process_regex(iter->hash, parser->buffer,
                                           parser->idx, enable);
                trace_parser_clear(parser);
-               if (ret)
+               if (ret < 0)
                        goto out_unlock;
        }