Keita Suzuki
8595e2aadd
tracing: Avoid memory leak in process_system_preds()
commit 79e65c27f0 upstream.
When failing in the allocation of filter_item, process_system_preds()
goes to fail_mem, where the allocated filter is freed.
However, this leads to memory leak of filter->filter_string and
filter->prog, which is allocated before and in process_preds().
This bug has been detected by kmemleak as well.
Fix this by changing kfree to __free_fiter.
unreferenced object 0xffff8880658007c0 (size 32):
comm "bash", pid 579, jiffies 4295096372 (age 17.752s)
hex dump (first 32 bytes):
63 6f 6d 6d 6f 6e 5f 70 69 64 20 20 3e 20 31 30 common_pid > 10
00 00 00 00 00 00 00 00 65 73 00 00 00 00 00 00 ........es......
backtrace:
[<0000000067441602>] kstrdup+0x2d/0x60
[<00000000141cf7b7>] apply_subsystem_event_filter+0x378/0x932
[<000000009ca32334>] subsystem_filter_write+0x5a/0x90
[<0000000072da2bee>] vfs_write+0xe1/0x240
[<000000004f14f473>] ksys_write+0xb4/0x150
[<00000000a968b4a0>] do_syscall_64+0x6d/0x1e0
[<000000001a189f40>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
unreferenced object 0xffff888060c22d00 (size 64):
comm "bash", pid 579, jiffies 4295096372 (age 17.752s)
hex dump (first 32 bytes):
01 00 00 00 00 00 00 00 00 e8 d7 41 80 88 ff ff ...........A....
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<00000000b8c1b109>] process_preds+0x243/0x1820
[<000000003972c7f0>] apply_subsystem_event_filter+0x3be/0x932
[<000000009ca32334>] subsystem_filter_write+0x5a/0x90
[<0000000072da2bee>] vfs_write+0xe1/0x240
[<000000004f14f473>] ksys_write+0xb4/0x150
[<00000000a968b4a0>] do_syscall_64+0x6d/0x1e0
[<000000001a189f40>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
unreferenced object 0xffff888041d7e800 (size 512):
comm "bash", pid 579, jiffies 4295096372 (age 17.752s)
hex dump (first 32 bytes):
70 bc 85 97 ff ff ff ff 0a 00 00 00 00 00 00 00 p...............
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<000000001e04af34>] process_preds+0x71a/0x1820
[<000000003972c7f0>] apply_subsystem_event_filter+0x3be/0x932
[<000000009ca32334>] subsystem_filter_write+0x5a/0x90
[<0000000072da2bee>] vfs_write+0xe1/0x240
[<000000004f14f473>] ksys_write+0xb4/0x150
[<00000000a968b4a0>] do_syscall_64+0x6d/0x1e0
[<000000001a189f40>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
Link: http://lkml.kernel.org/r/20191211091258.11310-1-keitasuzuki.park@sslab.ics.keio.ac.jp
Cc: Ingo Molnar <mingo@redhat.com>
Cc: stable@vger.kernel.org
Fixes: 404a3add43 ("tracing: Only add filter list when needed")
Signed-off-by: Keita Suzuki <keitasuzuki.park@sslab.ics.keio.ac.jp>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-09 10:19:02 +01:00
..
2019-12-31 16:35:20 +01:00
2019-12-17 20:34:56 +01:00
2019-02-12 19:47:19 +01:00
2020-01-04 19:12:43 +01:00
2019-12-13 08:51:04 +01:00
2019-12-01 09:17:13 +01:00
2019-10-07 18:57:10 +02:00
2019-10-11 18:21:06 +02:00
2020-01-09 10:18:58 +01:00
2019-12-01 09:16:14 +01:00
2019-05-31 06:46:30 -07:00
2019-12-31 16:36:22 +01:00
2020-01-04 19:13:35 +01:00
2020-01-09 10:19:02 +01:00
2019-05-31 06:46:05 -07:00
2019-12-13 08:51:11 +01:00
2019-12-13 08:51:02 +01:00
2019-05-31 06:46:17 -07:00
2019-12-01 09:17:17 +01:00
2019-11-24 08:20:18 +01:00
2020-01-09 10:19:00 +01:00
2019-10-11 18:21:23 +02:00
2019-08-09 17:52:34 +02:00
2019-12-05 09:21:04 +01:00
2019-12-01 09:17:38 +01:00
2019-04-20 09:16:02 +02:00
2019-05-31 06:46:19 -07:00
2019-06-04 08:02:34 +02:00
2019-09-21 07:17:02 +02:00
2019-02-12 19:47:20 +01:00
2019-11-24 08:20:29 +01:00
2019-12-05 09:20:26 +01:00
2019-12-01 09:17:38 +01:00
2019-01-13 09:51:04 +01:00
2019-12-17 20:35:57 +01:00
2019-07-26 09:14:25 +02:00
2019-12-01 09:17:10 +01:00
2019-07-26 09:14:01 +02:00
2019-01-13 09:51:06 +01:00
2019-07-10 09:53:41 +02:00
2019-03-13 14:02:35 -07:00
2019-09-16 08:22:20 +02:00
2019-11-20 18:46:21 +01:00
2019-02-12 19:47:25 +01:00
2019-06-15 11:54:01 +02:00
2020-01-04 19:13:17 +01:00
2020-01-09 10:18:59 +01:00
2019-04-03 06:26:29 +02:00
2019-12-17 20:35:50 +01:00