On Mon, 12 Mar 2018 19:54:14 +0100
Jiri Olsa <jo...@redhat.com> wrote:

> On Mon, Mar 12, 2018 at 02:40:01PM -0400, Steven Rostedt wrote:
> > On Mon, 12 Mar 2018 16:10:17 +0100
> > Jiri Olsa <jo...@redhat.com> wrote:
> >   
> > > got it crashed when clearing the filter via 'echo > filter'  
> > 
> > Awesome. I'll go and test this out. Thanks!
> > 
> > Hmm, could you pull my tree and test my branch: ftrace/core. I may have
> > already fixed this but haven't posted the latest (which I'll do before
> > pushing to next).  
> 
> I couldn't apply your patches from mailbox so I used your ftrace/core already
>

Jiri, If you apply the below, does it fix it for you?

-- Steve

diff --git a/kernel/trace/trace_events_filter.c 
b/kernel/trace/trace_events_filter.c
index a5a131ec3c9c..4099e141188c 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -1498,11 +1498,14 @@ static int process_preds(struct trace_event_call *call,
                return ret;
        }
 
-       prog = predicate_parse(filter_string, nr_parens, nr_preds,
+       if (!nr_preds) {
+               prog = NULL;
+       } else {
+               prog = predicate_parse(filter_string, nr_parens, nr_preds,
                               parse_pred, call, pe);
-       if (IS_ERR(prog))
-               return PTR_ERR(prog);
-
+               if (IS_ERR(prog))
+                       return PTR_ERR(prog);
+       }
        rcu_assign_pointer(filter->prog, prog);
        return 0;
 }

Reply via email to