Skip to content

Commit ca61d68

Browse files
Bartosz Golaszewskiandersson
authored andcommitted
firmware: qcom: scm: fix a NULL-pointer dereference
Some SCM calls can be invoked with __scm being NULL (the driver may not have been and will not be probed as there's no SCM entry in device-tree). Make sure we don't dereference a NULL pointer. Fixes: 449d0d8 ("firmware: qcom: scm: smc: switch to using the SCM allocator") Reported-by: Rudraksha Gupta <[email protected]> Closes: https://lore.kernel.org/lkml/[email protected]/ Reviewed-by: Konrad Dybcio <[email protected]> Tested-by: Rudraksha Gupta <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Reviewed-by: Stephan Gerhold <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]> Reviewed-by: Kuldeep Singh <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent d679071 commit ca61d68

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/firmware/qcom/qcom_scm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ static DEFINE_SPINLOCK(scm_query_lock);
216216

217217
struct qcom_tzmem_pool *qcom_scm_get_tzmem_pool(void)
218218
{
219-
return __scm->mempool;
219+
return __scm ? __scm->mempool : NULL;
220220
}
221221

222222
static enum qcom_scm_convention __get_convention(void)

0 commit comments

Comments
 (0)