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-04-14 21:40:06 +02:00
2020-04-03 11:30:20 -07:00
2020-04-07 10:43:42 -07:00
2020-04-03 13:12:26 -07:00
2020-04-08 21:46:57 +02:00
2020-04-08 11:33:46 +02:00
2020-04-10 15:36:22 -07:00
2020-04-14 10:08:50 +02:00
2019-11-27 11:42:01 -08:00
2020-04-08 12:05:07 +02:00
2020-04-06 21:42:36 +02:00
2020-04-10 13:18:57 -07:00
2020-04-14 08:36:41 +02:00
2020-04-15 11:06:50 +02:00
2020-04-16 12:10:54 +02:00
2020-04-22 21:24:00 -04:00
2020-03-25 11:50:48 +01:00
2019-12-18 18:07:31 +01:00
2019-06-05 17:37:17 +02:00
2020-03-23 18:19:06 +01:00
2020-04-06 08:58:42 -07:00
2020-03-31 15:04:17 -07:00
2020-03-12 10:42:51 -04:00
2020-02-22 20:36:47 -05:00
2020-03-12 10:42:51 -04:00
2019-06-05 17:37:17 +02:00
2020-02-21 11:22:15 -08:00
2020-02-04 03:05:26 +00:00
2020-02-14 16:05:04 +01:00
2019-06-05 17:36:37 +02:00
2020-03-30 18:06:39 -07:00
2019-06-19 17:09:06 +02:00
2019-05-21 10:50:45 +02:00
2020-03-25 10:04:01 -05:00
2019-05-21 11:52:39 +02:00
2019-09-25 17:51:39 -07:00
2020-04-02 11:22:17 -07:00
2020-04-07 10:43:42 -07:00
2019-06-03 15:49:06 +02:00
2020-04-15 09:56:32 +02:00
2019-10-06 09:11:37 -06:00
2020-03-30 16:17:15 -07:00
2019-11-11 20:10:01 +09:00
2019-05-21 10:50:45 +02:00
2019-07-12 11:05:40 -07:00
2020-03-21 16:00:24 +01:00
2019-08-29 15:10:10 +01:00
2020-04-07 10:43:44 -07:00
2020-03-25 10:04:01 -05:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-12-08 14:37:36 +01:00
2019-11-12 11:35:32 +01:00
2019-12-04 19:44:14 -08:00
2020-01-08 16:32:55 +00:00
2019-09-06 23:58:44 +02:00
2020-01-08 16:32:55 +00:00
2020-01-08 16:32:55 +00:00
2020-01-08 16:32:55 +00:00
2019-05-24 20:16:01 +02:00
2020-04-10 15:36:22 -07:00
2020-01-09 12:40:13 +01:00
2019-05-30 11:26:39 -07:00
2020-03-20 13:06:20 +01:00
2020-02-04 03:05:26 +00:00
2020-01-31 10:30:41 -08:00
2019-08-05 18:39:56 -04:00
2019-08-05 18:39:56 -04:00
2019-05-24 17:27:11 +02:00
2020-04-09 12:52:34 -07:00
2020-03-21 18:56:06 -07:00
2020-01-14 12:20:48 +01:00
2020-03-06 12:28:24 +11:00
2019-11-25 09:15:42 +01:00
2019-08-19 21:54:16 -07:00
2020-02-28 16:29:12 -06:00
2020-04-10 12:59:56 -07:00
2020-02-04 03:05:26 +00:00
2020-01-18 13:51:39 +01:00
2019-05-21 10:50:45 +02:00
2019-09-24 15:54:09 -07:00
2019-12-25 10:41:20 +01:00
2020-03-31 17:29:33 -07:00
2020-04-12 22:46:34 +02:00
2020-03-25 12:59:37 +01:00
2019-05-21 10:50:45 +02:00
2020-03-21 16:03:54 +01:00
2019-11-11 10:30:59 +01:00
2020-01-17 10:19:21 +01:00
2019-11-15 14:38:30 +01:00
2020-03-03 19:34:32 +01:00
2019-11-26 13:03:56 -06:00
2020-01-09 16:42:29 -07:00
2020-04-02 09:35:31 -07:00
2020-03-02 14:06:33 -07:00
2019-12-04 15:18:39 +01:00
2019-05-21 11:52:39 +02:00
2020-03-30 18:06:39 -07:00
2019-07-18 11:51:00 -07:00
2019-12-18 18:07:31 +01:00
2020-04-07 21:51:27 +02:00
2019-05-21 10:50:45 +02:00
2020-02-07 15:34:12 +01:00
2019-07-08 19:36:47 -07:00
2019-05-21 10:50:45 +02:00
2019-07-08 19:36:47 -07:00
2019-06-05 17:37:17 +02:00
2019-06-05 17:37:17 +02:00
2020-01-17 11:19:22 +01:00
2020-04-08 11:35:20 +02:00