All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: venus: core: Fix a potential NULL pointer dereference
@ 2021-09-20  5:46 Christophe JAILLET
  0 siblings, 0 replies; only message in thread
From: Christophe JAILLET @ 2021-09-20  5:46 UTC (permalink / raw)
  To: stanimir.varbanov, agross, bjorn.andersson, mchehab, mansur, swboyd
  Cc: linux-media, linux-arm-msm, linux-kernel, kernel-janitors,
	Christophe JAILLET

According to the code in 'venus_runtime_suspend()' and
'venus_runtime_resume()', 'pm_ops->core_power' can be NULL.

So make the same assumption in the error handling path of
'venus_runtime_suspend()' and add the missing check. This can avoid a
potential NULL pointer dereference.

Fixes: 9e8efdb57879 ("media: venus: core: vote for video-mem path")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/media/platform/qcom/venus/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index 7e54c5d571dc..593d4cbe44e0 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -470,7 +470,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;
 }
-- 
2.30.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-20  5:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-20  5:46 [PATCH] media: venus: core: Fix a potential NULL pointer dereference Christophe JAILLET

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.