Skip to content

Commit 539aabb

Browse files
gautshengregkh
authored andcommitted
amd-pstate: Fix memory leak in amd_pstate_epp_cpu_init()
[ Upstream commit beda3b3 ] On failure to set the epp, the function amd_pstate_epp_cpu_init() returns with an error code without freeing the cpudata object that was allocated at the beginning of the function. Ensure that the cpudata object is freed before returning from the function. This memory leak was discovered by Claude Opus 4.6 with the aid of Chris Mason's AI review-prompts (https://github.com/masoncl/review-prompts/tree/main/kernel). Assisted-by: Claude:claude-opus-4.6 review-prompts/linux Fixes: f9a378f ("cpufreq/amd-pstate: Set different default EPP policy for Epyc and Ryzen") Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org> Signed-off-by: Gautham R. Shenoy <gautham.shenoy@amd.com> Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 187c8be commit 539aabb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/cpufreq/amd-pstate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1525,7 +1525,7 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy)
15251525

15261526
ret = amd_pstate_set_epp(policy, cpudata->epp_default);
15271527
if (ret)
1528-
return ret;
1528+
goto free_cpudata1;
15291529

15301530
current_pstate_driver->adjust_perf = NULL;
15311531

0 commit comments

Comments
 (0)