Re: [2.6.31 PATCH] tracing/filters: always free pred onfilter_add_subsystem_pred() failure

From: Ingo Molnar
Date: Sat Aug 08 2009 - 12:02:26 EST



* Tom Zanussi <tzanussi@xxxxxxxxx> wrote:

> 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.

thanks, i've queued this up for .31.

Just to make sure: tracing/core has the filter code changed
substantially, and this issue seems to be moot there - correct?

So the total impact from both patches on -tip is the patch below -
right?

Ingo

diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 27c2dbe..490337a 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -1050,6 +1050,8 @@ static int replace_preds(struct event_subsystem *system,

pred = create_pred(elt->op, operand1, operand2);
add_pred:
+ if (!pred)
+ return -ENOMEM;
if (call)
err = filter_add_pred(ps, call, pred, false);
else
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/