Vamshi K Sthambamkadi
9da73974eb
tracing: Fix memory leaks in trace_events_hist.c
kmemleak report 1:
[<9092c50b>] kmem_cache_alloc_trace+0x138/0x270
[<05a2c9ed>] create_field_var+0xcf/0x180
[<528a2d68>] action_create+0xe2/0xc80
[<63f50b61>] event_hist_trigger_func+0x15b5/0x1920
[<28ea5d3d>] trigger_process_regex+0x7b/0xc0
[<3138e86f>] event_trigger_write+0x4d/0xb0
[<ffd66c19>] __vfs_write+0x30/0x200
[<4f424a0d>] vfs_write+0x96/0x1b0
[<da59a290>] ksys_write+0x53/0xc0
[<3717101a>] __ia32_sys_write+0x15/0x20
[<c5f23497>] do_fast_syscall_32+0x70/0x250
[<46e2629c>] entry_SYSENTER_32+0xaf/0x102
This is because save_vars[] of struct hist_trigger_data are
not destroyed
kmemleak report 2:
[<9092c50b>] kmem_cache_alloc_trace+0x138/0x270
[<6e5e97c5>] create_var+0x3c/0x110
[<de82f1b9>] create_field_var+0xaf/0x180
[<528a2d68>] action_create+0xe2/0xc80
[<63f50b61>] event_hist_trigger_func+0x15b5/0x1920
[<28ea5d3d>] trigger_process_regex+0x7b/0xc0
[<3138e86f>] event_trigger_write+0x4d/0xb0
[<ffd66c19>] __vfs_write+0x30/0x200
[<4f424a0d>] vfs_write+0x96/0x1b0
[<da59a290>] ksys_write+0x53/0xc0
[<3717101a>] __ia32_sys_write+0x15/0x20
[<c5f23497>] do_fast_syscall_32+0x70/0x250
[<46e2629c>] entry_SYSENTER_32+0xaf/0x102
struct hist_field allocated through create_var() do not initialize
"ref" field to 1. The code in __destroy_hist_field() does not destroy
object if "ref" is initialized to zero, the condition
if (--hist_field->ref > 1) always passes since unsigned int wraps.
kmemleak report 3:
[<f8666fcc>] __kmalloc_track_caller+0x139/0x2b0
[<bb7f80a5>] kstrdup+0x27/0x50
[<39d70006>] init_var_ref+0x58/0xd0
[<8ca76370>] create_var_ref+0x89/0xe0
[<f045fc39>] action_create+0x38f/0xc80
[<7c146821>] event_hist_trigger_func+0x15b5/0x1920
[<07de3f61>] trigger_process_regex+0x7b/0xc0
[<e87daf8f>] event_trigger_write+0x4d/0xb0
[<19bf1512>] __vfs_write+0x30/0x200
[<64ce4d27>] vfs_write+0x96/0x1b0
[<a6f34170>] ksys_write+0x53/0xc0
[<7d4230cd>] __ia32_sys_write+0x15/0x20
[<8eadca00>] do_fast_syscall_32+0x70/0x250
[<235cf985>] entry_SYSENTER_32+0xaf/0x102
hist_fields (system & event_name) are not freed
Link: http://lkml.kernel.org/r/20200422061503.GA5151@cosmos
Signed-off-by: Vamshi K Sthambamkadi <vamshi.k.sthambamkadi@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2020-04-22 21:24:00 -04:00
..
2020-03-05 13:42:40 -07:00
2020-03-30 19:52:37 -07:00
2020-01-02 21:56:44 -05:00
2019-08-01 14:16:21 -07:00
2020-04-05 10:36:18 -07:00
2020-02-25 19:07:58 -05:00
2020-01-30 09:46:28 -05:00
2020-01-30 09:46:28 -05:00
2019-11-13 09:37:28 -05:00
2020-01-13 13:19:38 -05:00
2020-03-27 16:39:01 -04:00
2020-02-20 17:43:41 -05:00
2019-10-18 15:01:57 +02:00
2018-08-16 19:08:06 -04:00
2020-01-31 12:59:26 -05:00
2020-01-13 13:19:38 -05:00
2018-08-16 19:08:06 -04:00
2020-02-01 13:10:15 -05:00
2020-02-01 13:09:23 -05:00
2020-03-03 17:33:43 -05:00
2019-10-28 12:38:26 +01:00
2018-08-16 19:08:06 -04:00
2019-12-19 18:24:17 -05:00
2020-04-22 21:24:00 -04:00
2020-01-02 19:04:57 -05:00
2020-04-14 22:02:10 -04:00
2020-03-27 16:39:02 -04:00
2019-12-10 10:11:00 +01:00
2020-03-19 19:11:19 -04:00
2020-01-13 13:19:38 -05:00
2020-03-03 17:33:43 -05:00
2020-01-13 13:19:38 -05:00
2020-01-13 13:19:38 -05:00
2018-07-30 18:41:04 -04:00
2018-08-16 19:08:06 -04:00
2020-03-27 16:39:02 -04:00
2020-01-13 13:19:38 -05:00
2020-03-19 17:48:36 -04:00
2018-08-16 19:08:06 -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-01-27 10:56:02 -05:00
2020-01-22 07:09:20 -05:00
2020-01-30 09:46:10 -05:00
2020-01-13 13:19:38 -05:00
2020-01-13 13:19:38 -05:00
2020-01-21 18:39:54 -05:00
2020-01-02 22:04:07 -05:00
2020-01-24 18:06:48 -05:00
2019-11-14 13:15:11 -05:00
2020-02-06 07:12:11 +00:00
2020-02-24 16:17:14 -08:00
2020-04-03 11:30:50 -04:00
2020-03-27 16:39:02 -04:00
2019-12-19 18:26:00 -05:00
2018-08-16 19:08:06 -04:00