mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-28 21:33:52 +00:00
perf kwork: Fix incorrect and missing free atom in work_push_atom()
1. Atoms are managed in page mode and should be released using atom_free()
instead of free().
2. When the event does not match, the atom needs to free.
Fixes: f98919ec4f
("perf kwork: Implement 'report' subcommand")
Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Sandipan Das <sandipan.das@amd.com>
Cc: Yang Jihong <yangjihong1@huawei.com>
Link: https://lore.kernel.org/r/20230812084917.169338-2-yangjihong1@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
d50ad02cb3
commit
d39710088d
1 changed files with 4 additions and 2 deletions
|
@ -406,12 +406,14 @@ static int work_push_atom(struct perf_kwork *kwork,
|
||||||
|
|
||||||
work = work_findnew(&class->work_root, &key, &kwork->cmp_id);
|
work = work_findnew(&class->work_root, &key, &kwork->cmp_id);
|
||||||
if (work == NULL) {
|
if (work == NULL) {
|
||||||
free(atom);
|
atom_free(atom);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!profile_event_match(kwork, work, sample))
|
if (!profile_event_match(kwork, work, sample)) {
|
||||||
|
atom_free(atom);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (dst_type < KWORK_TRACE_MAX) {
|
if (dst_type < KWORK_TRACE_MAX) {
|
||||||
dst_atom = list_last_entry_or_null(&work->atom_list[dst_type],
|
dst_atom = list_last_entry_or_null(&work->atom_list[dst_type],
|
||||||
|
|
Loading…
Reference in a new issue