Skip to content

Commit e33fa4a

Browse files
x2018gregkh
authored andcommitted
tracing/histogram: Fix a potential memory leak for kstrdup()
commit e629e7b upstream. kfree() is missing on an error path to free the memory allocated by kstrdup(): p = param = kstrdup(data->params[i], GFP_KERNEL); So it is better to free it via kfree(p). Link: https://lkml.kernel.org/r/tencent_C52895FD37802832A3E5B272D05008866F0A@qq.com Cc: stable@vger.kernel.org Fixes: d380dcd ("tracing: Fix now invalid var_ref_vals assumption in trace action") Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent fb9b60b commit e33fa4a

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎kernel/trace/trace_events_hist.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3581,6 +3581,7 @@ static int trace_action_create(struct hist_trigger_data *hist_data,
35813581

35823582
var_ref_idx = find_var_ref_idx(hist_data, var_ref);
35833583
if (WARN_ON(var_ref_idx < 0)) {
3584+
kfree(p);
35843585
ret = var_ref_idx;
35853586
goto err;
35863587
}

0 commit comments

Comments
 (0)