diff options
author | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2024-09-30 10:33:28 +0200 |
---|---|---|
committer | Bjorn Andersson <andersson@kernel.org> | 2024-10-06 05:01:52 +0200 |
commit | ca61d6836e6f4442a77762e1074d2706a2a6e578 (patch) | |
tree | 759a9b3e9fbebfb3e512e193bc340f280b5a6a9b /drivers/firmware/qcom | |
parent | firmware: qcom: scm: suppress download mode error (diff) | |
download | linux-ca61d6836e6f4442a77762e1074d2706a2a6e578.tar.xz linux-ca61d6836e6f4442a77762e1074d2706a2a6e578.zip |
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: 449d0d84bcd8 ("firmware: qcom: scm: smc: switch to using the SCM allocator")
Reported-by: Rudraksha Gupta <guptarud@gmail.com>
Closes: https://lore.kernel.org/lkml/692cfe9a-8c05-4ce4-813e-82b3f310019a@gmail.com/
Reviewed-by: Konrad Dybcio <konradybcio@kernel.org>
Tested-by: Rudraksha Gupta <guptarud@gmail.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Stephan Gerhold <stephan.gerhold@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Kuldeep Singh <quic_kuldsing@quicinc.com>
Link: https://lore.kernel.org/r/20240930083328.17904-1-brgl@bgdev.pl
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Diffstat (limited to 'drivers/firmware/qcom')
-rw-r--r-- | drivers/firmware/qcom/qcom_scm.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c index e2ac595902ed..f47fdf32d2da 100644 --- a/drivers/firmware/qcom/qcom_scm.c +++ b/drivers/firmware/qcom/qcom_scm.c @@ -216,7 +216,7 @@ static DEFINE_SPINLOCK(scm_query_lock); struct qcom_tzmem_pool *qcom_scm_get_tzmem_pool(void) { - return __scm->mempool; + return __scm ? __scm->mempool : NULL; } static enum qcom_scm_convention __get_convention(void) |