* [RESEND PATCH v2] firmware: qcom: scm: fix a NULL-pointer dereference
@ 2024-09-30 8:33 Bartosz Golaszewski
2024-09-30 9:26 ` Kuldeep Singh
2024-10-07 14:25 ` Bjorn Andersson
0 siblings, 2 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2024-09-30 8:33 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Andrew Halaney, Elliot Berman
Cc: linux-arm-msm, linux-kernel, Thorsten Leemhuis,
Bartosz Golaszewski, Rudraksha Gupta, Dmitry Baryshkov,
Stephan Gerhold
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
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>
---
I dropped patch 2/2 and am resending this separately rebased on top of
v6.12-rc1.
drivers/firmware/qcom/qcom_scm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c
index 10986cb11ec0..8bac4915c211 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)
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RESEND PATCH v2] firmware: qcom: scm: fix a NULL-pointer dereference
2024-09-30 8:33 [RESEND PATCH v2] firmware: qcom: scm: fix a NULL-pointer dereference Bartosz Golaszewski
@ 2024-09-30 9:26 ` Kuldeep Singh
2024-10-07 14:25 ` Bjorn Andersson
1 sibling, 0 replies; 3+ messages in thread
From: Kuldeep Singh @ 2024-09-30 9:26 UTC (permalink / raw)
To: Bartosz Golaszewski, Bjorn Andersson, Konrad Dybcio,
Andrew Halaney, Elliot Berman
Cc: linux-arm-msm, linux-kernel, Thorsten Leemhuis,
Bartosz Golaszewski, Rudraksha Gupta, Dmitry Baryshkov,
Stephan Gerhold
On 9/30/2024 2:03 PM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> 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>
> ---
> I dropped patch 2/2 and am resending this separately rebased on top of
> v6.12-rc1.
>
> drivers/firmware/qcom/qcom_scm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c
> index 10986cb11ec0..8bac4915c211 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)
--
Regards
Kuldeep
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RESEND PATCH v2] firmware: qcom: scm: fix a NULL-pointer dereference
2024-09-30 8:33 [RESEND PATCH v2] firmware: qcom: scm: fix a NULL-pointer dereference Bartosz Golaszewski
2024-09-30 9:26 ` Kuldeep Singh
@ 2024-10-07 14:25 ` Bjorn Andersson
1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Andersson @ 2024-10-07 14:25 UTC (permalink / raw)
To: Konrad Dybcio, Andrew Halaney, Elliot Berman, Bartosz Golaszewski
Cc: linux-arm-msm, linux-kernel, Thorsten Leemhuis,
Bartosz Golaszewski, Rudraksha Gupta, Dmitry Baryshkov,
Stephan Gerhold
On Mon, 30 Sep 2024 10:33:28 +0200, Bartosz Golaszewski wrote:
> 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.
>
>
Applied, thanks!
[1/1] firmware: qcom: scm: fix a NULL-pointer dereference
commit: ca61d6836e6f4442a77762e1074d2706a2a6e578
Best regards,
--
Bjorn Andersson <andersson@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-07 14:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-30 8:33 [RESEND PATCH v2] firmware: qcom: scm: fix a NULL-pointer dereference Bartosz Golaszewski
2024-09-30 9:26 ` Kuldeep Singh
2024-10-07 14:25 ` Bjorn Andersson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox