Merge tag 'trace-fix-filter-4.1-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace

Pull tracing filter fix from Steven Rostedt:
"Vince Weaver reported a warning when he added perf event filters into
his fuzzer tests. There's a missing check of balanced operations when
parenthesis are used, and this triggers a WARN_ON() and when reading
the failure, the filter reports no failure occurred.

The operands were not being checked if they match, this adds that"

* tag 'trace-fix-filter-4.1-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
tracing: Have filter check for balanced ops

Changed files
+9 -2
kernel
+9 -2
kernel/trace/trace_events_filter.c
··· 1369 1369 { 1370 1370 int n_normal_preds = 0, n_logical_preds = 0; 1371 1371 struct postfix_elt *elt; 1372 + int cnt = 0; 1372 1373 1373 1374 list_for_each_entry(elt, &ps->postfix, list) { 1374 - if (elt->op == OP_NONE) 1375 + if (elt->op == OP_NONE) { 1376 + cnt++; 1375 1377 continue; 1378 + } 1376 1379 1377 1380 if (elt->op == OP_AND || elt->op == OP_OR) { 1378 1381 n_logical_preds++; 1382 + cnt--; 1379 1383 continue; 1380 1384 } 1385 + if (elt->op != OP_NOT) 1386 + cnt--; 1381 1387 n_normal_preds++; 1388 + WARN_ON_ONCE(cnt < 0); 1382 1389 } 1383 1390 1384 - if (!n_normal_preds || n_logical_preds >= n_normal_preds) { 1391 + if (cnt != 1 || !n_normal_preds || n_logical_preds >= n_normal_preds) { 1385 1392 parse_error(ps, FILT_ERR_INVALID_FILTER, 0); 1386 1393 return -EINVAL; 1387 1394 }