Skip to content

Commit df86e2f

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 1ef81cd commit df86e2f

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
@@ -3919,6 +3919,7 @@ static int trace_action_create(struct hist_trigger_data *hist_data,
39193919

39203920
var_ref_idx = find_var_ref_idx(hist_data, var_ref);
39213921
if (WARN_ON(var_ref_idx < 0)) {
3922+
kfree(p);
39223923
ret = var_ref_idx;
39233924
goto err;
39243925
}

0 commit comments

Comments
 (0)