summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorTom Zanussi <tzanussi@gmail.com>2009-08-08 10:49:53 -0500
committerIngo Molnar <mingo@elte.hu>2009-08-08 17:56:13 +0200
commit26528e773ecc74fb1b61b7275f86f761cbb340ec (patch)
treee3892e1c58783cc022517dab31b1e18179cb930b /kernel
parent96b2de313b1e0e02aea80ee47df6a2b5cbdf8e13 (diff)
downloadlwn-26528e773ecc74fb1b61b7275f86f761cbb340ec.tar.gz
lwn-26528e773ecc74fb1b61b7275f86f761cbb340ec.zip
tracing/filters: Always free pred on filter_add_subsystem_pred() failure
If filter_add_subsystem_pred() fails due to ENOSPC or ENOMEM, the pred doesn't get freed, while as a side effect it does for other errors. Make it so the caller always frees the pred for any error. Signed-off-by: Tom Zanussi <tzanussi@gmail.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Li Zefan <lizf@cn.fujitsu.com> LKML-Reference: <1249746593.6453.32.camel@tropicana> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace_events_filter.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 1557148be34b..f32dc9d1ea7b 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -624,9 +624,6 @@ static int filter_add_subsystem_pred(struct filter_parse_state *ps,
return -ENOSPC;
}
- filter->preds[filter->n_preds] = pred;
- filter->n_preds++;
-
list_for_each_entry(call, &ftrace_events, list) {
if (!call->define_fields)
@@ -643,6 +640,9 @@ static int filter_add_subsystem_pred(struct filter_parse_state *ps,
}
replace_filter_string(call->filter, filter_string);
}
+
+ filter->preds[filter->n_preds] = pred;
+ filter->n_preds++;
out:
return err;
}
@@ -1034,9 +1034,12 @@ static int replace_preds(struct event_subsystem *system,
if (call) {
err = filter_add_pred(ps, call, pred);
filter_free_pred(pred);
- } else
+ } else {
err = filter_add_subsystem_pred(ps, system,
pred, filter_string);
+ if (err)
+ filter_free_pred(pred);
+ }
if (err)
return err;
@@ -1055,9 +1058,12 @@ static int replace_preds(struct event_subsystem *system,
if (call) {
err = filter_add_pred(ps, call, pred);
filter_free_pred(pred);
- } else
+ } else {
err = filter_add_subsystem_pred(ps, system, pred,
filter_string);
+ if (err)
+ filter_free_pred(pred);
+ }
if (err)
return err;