Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: venus: core: Fix a potential NULL pointer dereference in an error handling path

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>

authored by

Christophe JAILLET and committed by
Mauro Carvalho Chehab
e4debea9 91f2b7d2

+2 -1
+2 -1
drivers/media/platform/qcom/venus/core.c
··· 473 473 err_video_path: 474 474 icc_set_bw(core->cpucfg_path, kbps_to_icc(1000), 0); 475 475 err_cpucfg_path: 476 - pm_ops->core_power(core, POWER_ON); 476 + if (pm_ops->core_power) 477 + pm_ops->core_power(core, POWER_ON); 477 478 478 479 return ret; 479 480 }