]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
cpufreq: mediatek: fix KP caused by handler usage after regulator_put/clk_put
authorJia-Wei Chang <jia-wei.chang@mediatek.com>
Fri, 24 Mar 2023 10:11:28 +0000 (18:11 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 May 2023 14:11:01 +0000 (23:11 +0900)
commit650061e9385cc629e85f4bc067606e0fd8317246
treef83a8ad256293c7ba449b5dc1f2141965dd81976
parent84fb84c637996b5c34db13cf4fef66b100e713af
cpufreq: mediatek: fix KP caused by handler usage after regulator_put/clk_put

[ Upstream commit d51e106240bc755cbe59634b70d567c192b045b2 ]

Any kind of failure in mtk_cpu_dvfs_info_init() will lead to calling
regulator_put() or clk_put() and the KP will occur since the regulator/clk
handlers are used after released in mtk_cpu_dvfs_info_release().

To prevent the usage after regulator_put()/clk_put(), the regulator/clk
handlers are addressed in a way of "Free the Last Thing Style".

Signed-off-by: Jia-Wei Chang <jia-wei.chang@mediatek.com>
Fixes: 4b9ceb757bbb ("cpufreq: mediatek: Enable clocks and regulators")
Suggested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Suggested-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/cpufreq/mediatek-cpufreq.c