Zheng Yejian
d5a8218963
tracing: Fix memory leak of iter->temp when reading trace_pipe
kmemleak reports:
unreferenced object 0xffff88814d14e200 (size 256):
comm "cat", pid 336, jiffies 4294871818 (age 779.490s)
hex dump (first 32 bytes):
04 00 01 03 00 00 00 00 08 00 00 00 00 00 00 00 ................
0c d8 c8 9b ff ff ff ff 04 5a ca 9b ff ff ff ff .........Z......
backtrace:
[<ffffffff9bdff18f>] __kmalloc+0x4f/0x140
[<ffffffff9bc9238b>] trace_find_next_entry+0xbb/0x1d0
[<ffffffff9bc9caef>] trace_print_lat_context+0xaf/0x4e0
[<ffffffff9bc94490>] print_trace_line+0x3e0/0x950
[<ffffffff9bc95499>] tracing_read_pipe+0x2d9/0x5a0
[<ffffffff9bf03a43>] vfs_read+0x143/0x520
[<ffffffff9bf04c2d>] ksys_read+0xbd/0x160
[<ffffffff9d0f0edf>] do_syscall_64+0x3f/0x90
[<ffffffff9d2000aa>] entry_SYSCALL_64_after_hwframe+0x6e/0xd8
when reading file 'trace_pipe', 'iter->temp' is allocated or relocated
in trace_find_next_entry() but not freed before 'trace_pipe' is closed.
To fix it, free 'iter->temp' in tracing_release_pipe().
Link: https://lore.kernel.org/linux-trace-kernel/20230713141435.1133021-1-zhengyejian1@huawei.com
Cc: stable@vger.kernel.org
Fixes: ff895103a8 ("tracing: Save off entry when peeking at next entry")
Signed-off-by: Zheng Yejian <zhengyejian1@huawei.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2023-07-13 10:48:36 -04:00
..
2023-04-28 16:11:26 -07:00
2023-02-21 09:23:22 -07:00
2023-06-30 10:44:53 -07:00
2023-07-12 12:06:04 -04:00
2023-06-06 21:39:55 +09:00
2023-07-12 12:06:04 -04:00
2023-07-12 17:47:37 -04:00
2023-06-30 10:44:53 -07:00
2023-03-19 12:20:48 -04:00
2023-06-06 21:39:55 +09:00
2022-04-26 17:58:50 -04:00
2021-10-05 17:38:45 -04:00
2023-06-06 21:39:55 +09:00
2022-11-23 19:08:30 -05:00
2023-07-12 12:15:26 -04:00
2023-02-18 14:34:09 -05:00
2022-09-26 13:01:09 -04:00
2022-09-26 13:01:09 -04:00
2023-07-05 10:30:49 -04:00
2022-11-23 19:07:12 -05:00
2021-08-18 18:10:32 -04:00
2023-06-20 18:38:37 -04:00
2023-06-06 21:39:56 +09:00
2022-11-23 19:08:31 -05:00
2023-01-25 10:31:11 -05:00
2023-07-12 19:08:56 -04:00
2023-05-26 13:52:19 -07:00
2023-04-06 15:08:18 -04:00
2022-12-14 08:50:56 -05:00
2023-07-10 21:38:13 -04:00
2023-06-27 21:24:18 -07:00
2023-02-12 10:23:39 -05:00
2023-06-06 21:39:56 +09:00
2023-06-20 18:38:37 -04:00
2021-10-27 11:21:49 -04:00
2023-03-19 13:23:22 -04:00
2021-07-27 17:05:06 +01:00
2023-07-12 12:06:04 -04:00
2023-06-30 10:44:53 -07:00
2023-06-22 10:39:56 -04:00
2023-06-30 10:33:17 -07:00
2023-03-29 06:52:08 -04:00
2023-01-31 15:01:46 +01:00
2021-10-08 18:08:43 -04:00
2023-02-24 09:44:27 +09:00
2023-02-24 10:04:13 +09:00
2023-06-30 10:44:53 -07:00
2023-06-06 21:39:56 +09:00
2022-05-26 21:12:52 -04:00
2022-05-12 00:37:11 +02:00
2022-05-12 00:37:11 +02:00
2023-05-28 21:15:46 -04:00
2023-02-07 12:42:54 -05:00
2021-10-08 18:08:43 -04:00
2021-10-08 18:08:43 -04:00
2023-01-25 10:31:24 -05:00
2022-11-17 20:21:06 -05:00
2023-06-06 21:39:56 +09:00
2023-07-13 10:48:36 -04:00
2023-06-30 10:44:53 -07:00
2022-10-03 12:20:31 -04:00