Vamshi K Sthambamkadi
f4748ee4fa
tracing/probe: Fix memleak in fetch_op_data operations
commit 3aa8fdc37d upstream.
kmemleak report:
[<57dcc2ca>] __kmalloc_track_caller+0x139/0x2b0
[<f1c45d0f>] kstrndup+0x37/0x80
[<f9761eb0>] parse_probe_arg.isra.7+0x3cc/0x630
[<055bf2ba>] traceprobe_parse_probe_arg+0x2f5/0x810
[<655a7766>] trace_kprobe_create+0x2ca/0x950
[<4fc6a02a>] create_or_delete_trace_kprobe+0xf/0x30
[<6d1c8a52>] trace_run_command+0x67/0x80
[<be812cc0>] trace_parse_run_command+0xa7/0x140
[<aecfe401>] probes_write+0x10/0x20
[<2027641c>] __vfs_write+0x30/0x1e0
[<6a4aeee1>] vfs_write+0x96/0x1b0
[<3517fb7d>] ksys_write+0x53/0xc0
[<dad91db7>] __ia32_sys_write+0x15/0x20
[<da347f64>] do_syscall_32_irqs_on+0x3d/0x260
[<fd0b7e7d>] do_fast_syscall_32+0x39/0xb0
[<ea5ae810>] entry_SYSENTER_32+0xaf/0x102
Post parse_probe_arg(), the FETCH_OP_DATA operation type is overwritten
to FETCH_OP_ST_STRING, as a result memory is never freed since
traceprobe_free_probe_arg() iterates only over SYMBOL and DATA op types
Setup fetch string operation correctly after fetch_op_data operation.
Link: https://lkml.kernel.org/r/20200615143034.GA1734@cosmos
Cc: stable@vger.kernel.org
Fixes: a42e3c4de9 ("tracing/probe: Add immediate string parameter support")
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Vamshi K Sthambamkadi <vamshi.k.sthambamkadi@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-06-24 17:50:51 +02:00
..
2020-06-24 17:50:39 +02:00
2020-04-17 10:49:57 +02:00
2019-09-18 12:24:47 +10:00
2019-08-01 14:16:21 -07:00
2020-02-24 08:36:59 +01:00
2020-05-20 08:20:28 +02:00
2019-07-31 19:03:35 +02:00
2020-01-12 12:21:45 +01:00
2019-04-03 11:02:24 +02:00
2019-10-12 20:44:07 -04:00
2019-08-31 12:19:38 -04:00
2019-02-11 14:53:43 -05:00
2019-10-21 19:38:28 -04:00
2020-01-09 10:20:00 +01:00
2020-05-10 10:31:28 +02:00
2020-04-21 09:04:59 +02:00
2020-01-09 10:19:59 +01:00
2019-07-30 21:50:03 -04:00
2019-10-12 20:49:33 -04:00
2019-03-11 17:01:32 -07:00
2019-05-25 23:04:30 -04:00
2020-06-24 17:50:43 +02:00
2019-09-17 11:21:28 -04:00
2019-02-13 08:16:40 +01:00
2019-10-12 20:48:06 -04:00
2019-05-25 23:04:42 -04:00
2020-06-24 17:50:51 +02:00
2020-02-05 21:22:53 +00:00
2020-02-11 04:35:07 -08:00
2020-01-14 20:08:22 +01:00
2019-04-21 19:46:56 -04:00
2020-01-14 20:08:22 +01:00
2020-02-24 08:36:30 +01:00
2019-04-05 09:26:43 -04:00
2020-06-24 17:50:43 +02:00
2020-05-14 07:58:25 +02:00
2020-02-11 04:35:28 -08:00
2020-01-09 10:20:00 +01:00