Commit fc3a7b18 authored by Tiezhu Yang's avatar Tiezhu Yang Committed by Wenyu Huang
Browse files

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 aaac9a1b ]

Use clk_disable_unprepare() in the error path of mtk_phy_init() to fix
some resource leaks.

Reported-by: default avatarkernel test robot <lkp@intel.com>
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
Reviewed-by: default avatarChunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/1621420659-15858-1-git-send-email-yangtiezhu@loongson.cn


Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarWenyu Huang <huangwenyu5@huawei.com>
parent 0a378cfa
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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;
	}