]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
media: venus: core: Fix a potential NULL pointer dereference in an error handling...
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Thu, 12 Aug 2021 05:14:22 +0000 (07:14 +0200)
committerPaolo Pisati <paolo.pisati@canonical.com>
Fri, 28 Jan 2022 09:59:19 +0000 (10:59 +0100)
BugLink: https://bugs.launchpad.net/bugs/1959376
[ Upstream commit e4debea9be7d5db52bc6a565a4c02c3c6560d093 ]

The normal path of the function makes the assumption that
'pm_ops->core_power' may be NULL.
We should make the same assumption in the error handling path or a NULL
pointer dereference may occur.

Add the missing test before calling 'pm_ops->core_power'

Fixes: 9e8efdb57879 ("media: venus: core: vote for video-mem path")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/media/platform/qcom/venus/core.c

index 91b15842c55585275dab814cd10098d666a77437..84cd92628cfdcbd65c533c02d13f87f13842981f 100644 (file)
@@ -472,7 +472,8 @@ static __maybe_unused int venus_runtime_suspend(struct device *dev)
 err_video_path:
        icc_set_bw(core->cpucfg_path, kbps_to_icc(1000), 0);
 err_cpucfg_path:
-       pm_ops->core_power(core, POWER_ON);
+       if (pm_ops->core_power)
+               pm_ops->core_power(core, POWER_ON);
 
        return ret;
 }