Commit 2e8b843a authored by 倪琛's avatar 倪琛 Committed by openeuler-sync-bot
Browse files

drm/tegra: dsi: Add missing check for of_find_device_by_node

stable inclusion
from stable-v5.10.214
commit 92003981a6df5dc84af8a5904f8ee112fa324129
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9L9OA
CVE: CVE-2023-52650

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



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

[ Upstream commit afe6fcb9775882230cd29b529203eabd5d2a638d ]

Add check for the return value of of_find_device_by_node() and return
the error if it fails in order to avoid NULL pointer dereference.

Fixes: e94236cd ("drm/tegra: dsi: Add ganged mode support")
Signed-off-by: default avatarChen Ni <nichen@iscas.ac.cn>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231024080738.825553-1-nichen@iscas.ac.cn


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarYuntao Liu <liuyuntao12@huawei.com>
(cherry picked from commit 925c1ab2)
parent 4244c006
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1534,9 +1534,11 @@ static int tegra_dsi_ganged_probe(struct tegra_dsi *dsi)
	np = of_parse_phandle(dsi->dev->of_node, "nvidia,ganged-mode", 0);
	if (np) {
		struct platform_device *gangster = of_find_device_by_node(np);
		of_node_put(np);
		if (!gangster)
			return -EPROBE_DEFER;

		dsi->slave = platform_get_drvdata(gangster);
		of_node_put(np);

		if (!dsi->slave) {
			put_device(&gangster->dev);