Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cceceac1 authored by Ashok Vuyyuru's avatar Ashok Vuyyuru
Browse files

firmware: qcom_scm: Check for NULL before dereferencing __scm



The function qcom_scm_mem_protect_region_id dereferences __scm without
checking for NULL and could potentially lead to a NULL pointer exception.
This scenario can happen if the clinet calls qcom_scm_mem_protect_region_id
before qcom_scm driver is even probed. Hence, check for NULL before
dereferencing it.

Change-Id: I1a9eba6d45ba8ebf73da80bca984b4dfad05042e
Signed-off-by: default avatarAshok Vuyyuru <avuyyuru@codeaurora.org>
parent 1483d01d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1207,7 +1207,7 @@ int __qcom_scm_mem_protect_region_id(struct device *dev, phys_addr_t paddr,

	desc.args[0] = paddr;
	desc.args[1] = size;
	desc.arginfo = QCOM_SCM_ARGS(2);
	desc.arginfo = QCOM_SCM_ARGS(2, QCOM_SCM_RO, QCOM_SCM_VAL);

	ret = qcom_scm_call(dev, &desc);

+2 −1
Original line number Diff line number Diff line
@@ -452,7 +452,8 @@ EXPORT_SYMBOL(qcom_scm_mem_protect_video);

int qcom_scm_mem_protect_region_id(phys_addr_t paddr, size_t size)
{
	return __qcom_scm_mem_protect_region_id(__scm->dev, paddr, size);
	return __qcom_scm_mem_protect_region_id(__scm ? __scm->dev : NULL,
								paddr, size);
}
EXPORT_SYMBOL(qcom_scm_mem_protect_region_id);