]> git.baikalelectronics.ru Git - kernel.git/commit
tracing: fix double free
authorTom Rix <trix@redhat.com>
Mon, 7 Sep 2020 13:58:45 +0000 (06:58 -0700)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Fri, 18 Sep 2020 17:16:40 +0000 (13:16 -0400)
commit955d06b86ab607b0057a4bebd872a3d580af9801
tree4a850c5d79dcd719ba0cc74654377baec83378b6
parent42ff335c870623a449f11b4ac30c3dfd8906f0f0
tracing: fix double free

clang static analyzer reports this problem

trace_events_hist.c:3824:3: warning: Attempt to free
  released memory
    kfree(hist_data->attrs->var_defs.name[i]);

In parse_var_defs() if there is a problem allocating
var_defs.expr, the earlier var_defs.name is freed.
This free is duplicated by free_var_defs() which frees
the rest of the list.

Because free_var_defs() has to run anyway, remove the
second free fom parse_var_defs().

Link: https://lkml.kernel.org/r/20200907135845.15804-1-trix@redhat.com
Cc: stable@vger.kernel.org
Fixes: 872211e935bd ("tracing: Add variable support to hist triggers")
Reviewed-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/trace/trace_events_hist.c