diff options
author | Xiaoke Wang <xkernel.wang@foxmail.com> | 2021-12-14 09:28:02 +0800 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2022-01-13 16:23:04 -0500 |
commit | 8c7224245557707c613f130431cafbaaa4889615 (patch) | |
tree | 18eebe9541c5bb5d5f6783a2776747cb892cf5b9 /kernel/trace | |
parent | 289e7b0f7eb47b87a0441e6c81336316f301eb39 (diff) |
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.com
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Fixes: 33ea4b24277b ("perf/core: Implement the 'perf_uprobe' PMU")
Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/trace_uprobe.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index 3bd09d612137..08b0e8417302 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c @@ -1609,6 +1609,11 @@ create_local_trace_uprobe(char *name, unsigned long offs, tu->path = path; tu->ref_ctr_offset = ref_ctr_offset; tu->filename = kstrdup(name, GFP_KERNEL); + if (!tu->filename) { + ret = -ENOMEM; + goto error; + } + init_trace_event_call(tu); ptype = is_ret_probe(tu) ? PROBE_PRINT_RETURN : PROBE_PRINT_NORMAL; |