Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1327794
| From | Wang Nan <wangnan0@huawei.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 01/54] perf tools: Fix dangling pointers in parse_events__free_terms |
| Date | 2016-02-05 15:30 +0100 |
| Message-ID | <qYPyy-1p9-37@gated-at.bofh.it> (permalink) |
| References | <qYPfb-1gO-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
We expect parse_events__free_terms() destory the full config term list.
However, current code leaves the list header unclean, and points to
a invalidated linked list.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
---
tools/perf/util/parse-events.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 813d9b2..e8b2d85 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -2072,8 +2072,15 @@ void parse_events__free_terms(struct list_head *terms)
{
struct parse_events_term *term, *h;
- list_for_each_entry_safe(term, h, terms, list)
+ if (!terms)
+ return;
+
+ list_for_each_entry_safe(term, h, terms, list) {
+ list_del(&term->list);
free(term);
+ }
+
+ free(terms);
}
void parse_events_evlist_error(struct parse_events_evlist *data,
--
1.8.3.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/54] perf tools: Bugfix, BPF improvements and overwrite ring buffer support Wang Nan <wangnan0@huawei.com> - 2016-02-05 15:20 +0100 [PATCH 08/54] perf record: Apply config to BPF objects before recording Wang Nan <wangnan0@huawei.com> - 2016-02-05 15:30 +0100 [PATCH 19/54] perf core: Introduce new ioctl options to pause and resume ring buffer Wang Nan <wangnan0@huawei.com> - 2016-02-05 15:30 +0100 [PATCH 09/54] perf tools: Enable passing event to BPF object Wang Nan <wangnan0@huawei.com> - 2016-02-05 15:30 +0100 [PATCH 21/54] perf core: Prepare writing into ring buffer from end Wang Nan <wangnan0@huawei.com> - 2016-02-05 15:30 +0100 [PATCH 05/54] perf data: Fix releasing event_class Wang Nan <wangnan0@huawei.com> - 2016-02-05 15:30 +0100 [PATCH 02/54] perf tools: Fix symbols searching for offline module in buildid-cache Wang Nan <wangnan0@huawei.com> - 2016-02-05 15:30 +0100 [PATCH 04/54] perf tools: Adjust symbol for shared objects Wang Nan <wangnan0@huawei.com> - 2016-02-05 15:30 +0100 [PATCH 01/54] perf tools: Fix dangling pointers in parse_events__free_terms Wang Nan <wangnan0@huawei.com> - 2016-02-05 15:30 +0100 [PATCH 03/54] perf tools: Record text offset in dso to calculate objdump address Wang Nan <wangnan0@huawei.com> - 2016-02-05 15:30 +0100
csiph-web