summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorXiaoke Wang <xkernel.wang@foxmail.com>2022-01-25 07:07:15 +0300
committerSteven Rostedt (Google) <rostedt@goodmis.org>2022-01-28 03:15:44 +0300
commite629e7b525a179e29d53463d992bdee759c950fb (patch)
tree9b3e6b47fb8de12ad01e28e23708d55c02a65b80 /kernel
parent4ed308c445a1e3abac8f6c17928c1cb533867e38 (diff)
downloadlinux-e629e7b525a179e29d53463d992bdee759c950fb.tar.xz
tracing/histogram: Fix a potential memory leak for kstrdup()
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: d380dcde9a07c ("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>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace_events_hist.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index 5e6a988a8a51..cd9610688ddc 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -3935,6 +3935,7 @@ static int trace_action_create(struct hist_trigger_data *hist_data,
var_ref_idx = find_var_ref_idx(hist_data, var_ref);
if (WARN_ON(var_ref_idx < 0)) {
+ kfree(p);
ret = var_ref_idx;
goto err;
}