Commit 8c722424 authored by Xiaoke Wang's avatar Xiaoke Wang Committed by Steven Rostedt

tracing/uprobes: Check the return value of kstrdup() for tu->filename

kstrdup() returns NULL when some internal memory errors happen, it is
better to check the return value of it so to catch the memory error in
time.

Link: https://lkml.kernel.org/r/tencent_3C2E330722056D7891D2C83F29C802734B06@qq.comAcked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Fixes: 33ea4b24 ("perf/core: Implement the 'perf_uprobe' PMU")
Signed-off-by: default avatarXiaoke Wang <xkernel.wang@foxmail.com>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 289e7b0f
...@@ -1609,6 +1609,11 @@ create_local_trace_uprobe(char *name, unsigned long offs, ...@@ -1609,6 +1609,11 @@ create_local_trace_uprobe(char *name, unsigned long offs,
tu->path = path; tu->path = path;
tu->ref_ctr_offset = ref_ctr_offset; tu->ref_ctr_offset = ref_ctr_offset;
tu->filename = kstrdup(name, GFP_KERNEL); tu->filename = kstrdup(name, GFP_KERNEL);
if (!tu->filename) {
ret = -ENOMEM;
goto error;
}
init_trace_event_call(tu); init_trace_event_call(tu);
ptype = is_ret_probe(tu) ? PROBE_PRINT_RETURN : PROBE_PRINT_NORMAL; ptype = is_ret_probe(tu) ? PROBE_PRINT_RETURN : PROBE_PRINT_NORMAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment