OrangePi_CM5/kernel/trace
Shang XiaoJing bef08acbe5 tracing: kprobe: Fix memory leak in test_gen_kprobe/kretprobe_cmd()
commit 66f0919c953ef7b55e5ab94389a013da2ce80a2c upstream.

test_gen_kprobe_cmd() only free buf in fail path, hence buf will leak
when there is no failure. Move kfree(buf) from fail path to common path
to prevent the memleak. The same reason and solution in
test_gen_kretprobe_cmd().

unreferenced object 0xffff888143b14000 (size 2048):
  comm "insmod", pid 52490, jiffies 4301890980 (age 40.553s)
  hex dump (first 32 bytes):
    70 3a 6b 70 72 6f 62 65 73 2f 67 65 6e 5f 6b 70  p:kprobes/gen_kp
    72 6f 62 65 5f 74 65 73 74 20 64 6f 5f 73 79 73  robe_test do_sys
  backtrace:
    [<000000006d7b836b>] kmalloc_trace+0x27/0xa0
    [<0000000009528b5b>] 0xffffffffa059006f
    [<000000008408b580>] do_one_initcall+0x87/0x2a0
    [<00000000c4980a7e>] do_init_module+0xdf/0x320
    [<00000000d775aad0>] load_module+0x3006/0x3390
    [<00000000e9a74b80>] __do_sys_finit_module+0x113/0x1b0
    [<000000003726480d>] do_syscall_64+0x35/0x80
    [<000000003441e93b>] entry_SYSCALL_64_after_hwframe+0x46/0xb0

Link: https://lore.kernel.org/all/20221102072954.26555-1-shangxiaojing@huawei.com/

Fixes: 64836248dd ("tracing: Add kprobe event command generation test module")
Cc: stable@vger.kernel.org
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-11-10 18:14:26 +01:00
..
Kconfig
…
Makefile
…
blktrace.c blktrace: Trace remapped requests correctly 2022-08-21 15:15:36 +02:00
bpf_trace.c bpf: Remove config check to enable bpf support for branch records 2022-01-27 10:53:54 +01:00
bpf_trace.h
…
fgraph.c
…
ftrace.c ftrace: Fix use-after-free for dynamic ftrace_ops 2022-11-10 18:14:25 +01:00
ftrace_internal.h
…
kprobe_event_gen_test.c tracing: kprobe: Fix memory leak in test_gen_kprobe/kretprobe_cmd() 2022-11-10 18:14:26 +01:00
power-traces.c
…
preemptirq_delay_test.c
…
ring_buffer.c ring-buffer: Fix race between reset page and reading page 2022-10-26 13:25:15 +02:00
ring_buffer_benchmark.c
…
rpm-traces.c
…
synth_event_gen_test.c
…
trace.c tracing: Do not free snapshot if tracer is on cmdline 2022-10-30 09:41:18 +01:00
trace.h tracing: Fix pid filtering when triggers are attached 2021-12-01 09:19:01 +01:00
trace_benchmark.c
…
trace_benchmark.h
…
trace_boot.c
…
trace_branch.c
…
trace_clock.c
…
trace_dynevent.c
…
trace_dynevent.h
…
trace_entries.h
…
trace_event_perf.c
…
trace_events.c tracing: Have filter accept "common_cpu" to be consistent 2022-08-25 11:37:51 +02:00
trace_events_filter.c tracing: Add ustring operation to filtering string pointers 2022-03-08 19:09:31 +01:00
trace_events_filter_test.h
…
trace_events_hist.c tracing/histograms: Fix memory leak problem 2022-07-21 21:19:59 +02:00
trace_events_inject.c
…
trace_events_synth.c
…
trace_events_trigger.c tracing: Dump stacktrace trigger to the corresponding instance 2022-04-27 13:53:46 +02:00
trace_export.c
…
trace_functions.c
…
trace_functions_graph.c
…
trace_hwlat.c
…
trace_irqsoff.c
…
trace_kdb.c
…
trace_kprobe.c tracing: Fix return value of __setup handlers 2022-03-08 19:09:38 +01:00
trace_kprobe_selftest.c
…
trace_kprobe_selftest.h
…
trace_mmiotrace.c
…
trace_nop.c
…
trace_output.c
…
trace_output.h
…
trace_preemptirq.c tracing: hold caller_addr to hardirq_{enable,disable}_ip 2022-09-23 14:16:58 +02:00
trace_printk.c
…
trace_probe.c tracing/probes: Have kprobes and uprobes use $COMM too 2022-08-25 11:38:23 +02:00
trace_probe.h
…
trace_probe_tmpl.h
…
trace_sched_switch.c
…
trace_sched_wakeup.c
…
trace_selftest.c
…
trace_selftest_dynamic.c
…
trace_seq.c
…
trace_stack.c
…
trace_stat.c
…
trace_stat.h
…
trace_synth.h
…
trace_syscalls.c
…
trace_uprobe.c tracing/uprobe: Fix uprobe_perf_open probes iteration 2021-12-01 09:19:01 +01:00
tracing_map.c tracing: Fix a kmemleak false positive in tracing_map 2021-12-17 10:14:40 +01:00
tracing_map.h
…