Skip to content

Commit

Permalink
tracing: Fix use-after-free in hist_register_trigger()
Browse files Browse the repository at this point in the history
This fixes a use-after-free case flagged by KASAN; make sure the test
happens before the potential free in this case.

Link: http://lkml.kernel.org/r/48fd74ab61bebd7dca9714386bb47d7c5ccd6a7b.1467247517.git.tom.zanussi@linux.intel.com

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Tom Zanussi authored and Steven Rostedt committed Aug 2, 2016
1 parent 47c1856 commit 7522c03
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kernel/trace/trace_events_hist.c
Original file line number Diff line number Diff line change
Expand Up @@ -1441,16 +1441,16 @@ static int hist_register_trigger(char *glob, struct event_trigger_ops *ops,
goto out;
}

if (hist_data->attrs->pause)
data->paused = true;

if (named_data) {
destroy_hist_data(data->private_data);
data->private_data = named_data->private_data;
set_named_trigger_data(data, named_data);
data->ops = &event_hist_trigger_named_ops;
}

if (hist_data->attrs->pause)
data->paused = true;

if (data->ops->init) {
ret = data->ops->init(data->ops, data);
if (ret < 0)
Expand Down

0 comments on commit 7522c03

Please sign in to comment.