Re: [PATCH 2/2] tracing: Fix kmemleak in set_trigger_filter

From: Steven Rostedt
Date: Wed Aug 23 2017 - 12:52:57 EST


On Wed, 23 Aug 2017 10:41:55 -0400
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> * On success, returns 0 and *@filterp points to the new filter. On
> * failure, returns -errno and *@filterp may point to %NULL or to a new
> * filter. In the latter case, the returned filter contains error
> * information if @set_str is %true and the caller is responsible for
> * freeing it.
>
> So filter contains an error string when it fails. It seems that we
> should somehow propagate that up the chain to display. I'll look more
> into this.

The bug is in create_filter(), because "set_str" is set to false, and
the filter should not be passed back allocated on error.

The correct fix is below.

Thanks!

-- Steve