Commit c7dd0110 authored by Miaoqian Lin's avatar Miaoqian Lin Committed by Liu Shixin
Browse files

ASoC: mediatek: Fix error handling in mt8173_max98090_dev_probe

stable inclusion
from stable-v4.19.247
commit cc43b9fdca519c5b13be6a717bacbebccd628cf6
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IBP6WS
CVE: CVE-2022-49514

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



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

[ Upstream commit 4f4e0454 ]

Call of_node_put(platform_node) to avoid refcount leak in
the error path.

Fixes: 94319ba1 ("ASoC: mediatek: Use platform_of_node for machine drivers")
Fixes: 49343378 ("ASoC: mediatek: mt8173: fix device_node leak")
Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220404092903.26725-1-linmq006@gmail.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarLiu Shixin <liushixin2@huawei.com>
parent 2589e945
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -156,7 +156,8 @@ static int mt8173_max98090_dev_probe(struct platform_device *pdev)
	if (!codec_node) {
		dev_err(&pdev->dev,
			"Property 'audio-codec' missing or invalid\n");
		return -EINVAL;
		ret = -EINVAL;
		goto put_platform_node;
	}
	for (i = 0; i < card->num_links; i++) {
		if (mt8173_max98090_dais[i].codec_name)
@@ -171,6 +172,8 @@ static int mt8173_max98090_dev_probe(struct platform_device *pdev)
			__func__, ret);

	of_node_put(codec_node);

put_platform_node:
	of_node_put(platform_node);
	return ret;
}