Commit 09c70578 authored by Yang Jihong's avatar Yang Jihong Committed by Wentao Guan
Browse files

perf sched timehist: Fix missing free of session in perf_sched__timehist()

stable inclusion
from stable-v6.6.54
commit 505ec05002c75eef4647a747566cbe294e6dec00
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IAZ3K2

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=505ec05002c75eef4647a747566cbe294e6dec00



--------------------------------

[ Upstream commit 6bdf5168b6fb19541b0c1862bdaa596d116c7bfb ]

When perf_time__parse_str() fails in perf_sched__timehist(),
need to free session that was previously created, fix it.

Fixes: 853b7407 ("perf sched timehist: Add option to specify time window of interest")
Signed-off-by: default avatarYang Jihong <yangjihong@bytedance.com>
Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: David Ahern <dsa@cumulusnetworks.com>
Cc: Ian Rogers <irogers@google.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: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240806023533.1316348-1-yangjihong@bytedance.com


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
(cherry picked from commit 505ec05002c75eef4647a747566cbe294e6dec00)
Signed-off-by: default avatarWentao Guan <guanwentao@uniontech.com>
parent f3a67e49
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -3068,7 +3068,8 @@ static int perf_sched__timehist(struct perf_sched *sched)

	if (perf_time__parse_str(&sched->ptime, sched->time_str) != 0) {
		pr_err("Invalid time string\n");
		return -EINVAL;
		err = -EINVAL;
		goto out;
	}

	if (timehist_check_attr(sched, evlist) != 0)