From fc3a7b186f00af9a06f583216623bb645d8bb8d1 Mon Sep 17 00:00:00 2001 From: Tiezhu Yang Date: Wed, 5 Jun 2024 02:36:26 +0000 Subject: [PATCH] phy: phy-mtk-tphy: Fix some resource leaks in mtk_phy_init() stable inclusion from stable-v5.10.46 commit 9a17907946232d01aa2ec109da5f93b8d31dd425 category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9R4IN CVE: CVE-2021-47234 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=9a17907946232d01aa2ec109da5f93b8d31dd425 -------------------------------- [ Upstream commit aaac9a1bd370338ce372669eb9a6059d16b929aa ] Use clk_disable_unprepare() in the error path of mtk_phy_init() to fix some resource leaks. Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Tiezhu Yang Reviewed-by: Chunfeng Yun Link: https://lore.kernel.org/r/1621420659-15858-1-git-send-email-yangtiezhu@loongson.cn Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Signed-off-by: Wenyu Huang --- drivers/phy/mediatek/phy-mtk-tphy.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c index 3eb8e1bd7b78..889e7ea68792 100644 --- a/drivers/phy/mediatek/phy-mtk-tphy.c +++ b/drivers/phy/mediatek/phy-mtk-tphy.c @@ -924,6 +924,8 @@ static int mtk_phy_init(struct phy *phy) break; default: dev_err(tphy->dev, "incompatible PHY type\n"); + clk_disable_unprepare(instance->ref_clk); + clk_disable_unprepare(tphy->u3phya_ref); return -EINVAL; } -- Gitee