* [PATCH] firmware: qcom: uefisecapp: Fix deadlock in qcuefi_acquire()
@ 2024-08-29 19:23 Dan Carpenter
2024-08-30 7:42 ` Dmitry Baryshkov
2024-08-31 3:18 ` Bjorn Andersson
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2024-08-29 19:23 UTC (permalink / raw)
To: Maximilian Luz
Cc: Bjorn Andersson, Konrad Dybcio, Johan Hovold, Ard Biesheuvel,
linux-arm-msm, linux-kernel, kernel-janitors
If the __qcuefi pointer is not set, then in the original code, we would
hold onto the lock. That means that if we tried to set it later, then
it would cause a deadlock. Drop the lock on the error path. That's
what all the callers are expecting.
Fixes: 759e7a2b62eb ("firmware: Add support for Qualcomm UEFI Secure Application")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/firmware/qcom/qcom_qseecom_uefisecapp.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/firmware/qcom/qcom_qseecom_uefisecapp.c b/drivers/firmware/qcom/qcom_qseecom_uefisecapp.c
index 6fefa4fe80e8..447246bd04be 100644
--- a/drivers/firmware/qcom/qcom_qseecom_uefisecapp.c
+++ b/drivers/firmware/qcom/qcom_qseecom_uefisecapp.c
@@ -715,6 +715,10 @@ static int qcuefi_set_reference(struct qcuefi_client *qcuefi)
static struct qcuefi_client *qcuefi_acquire(void)
{
mutex_lock(&__qcuefi_lock);
+ if (!__qcuefi) {
+ mutex_unlock(&__qcuefi_lock);
+ return NULL;
+ }
return __qcuefi;
}
--
2.45.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] firmware: qcom: uefisecapp: Fix deadlock in qcuefi_acquire()
2024-08-29 19:23 [PATCH] firmware: qcom: uefisecapp: Fix deadlock in qcuefi_acquire() Dan Carpenter
@ 2024-08-30 7:42 ` Dmitry Baryshkov
2024-08-31 3:18 ` Bjorn Andersson
1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Baryshkov @ 2024-08-30 7:42 UTC (permalink / raw)
To: Dan Carpenter
Cc: Maximilian Luz, Bjorn Andersson, Konrad Dybcio, Johan Hovold,
Ard Biesheuvel, linux-arm-msm, linux-kernel, kernel-janitors
On Thu, Aug 29, 2024 at 10:23:04PM GMT, Dan Carpenter wrote:
> If the __qcuefi pointer is not set, then in the original code, we would
> hold onto the lock. That means that if we tried to set it later, then
> it would cause a deadlock. Drop the lock on the error path. That's
> what all the callers are expecting.
>
> Fixes: 759e7a2b62eb ("firmware: Add support for Qualcomm UEFI Secure Application")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> drivers/firmware/qcom/qcom_qseecom_uefisecapp.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] firmware: qcom: uefisecapp: Fix deadlock in qcuefi_acquire()
2024-08-29 19:23 [PATCH] firmware: qcom: uefisecapp: Fix deadlock in qcuefi_acquire() Dan Carpenter
2024-08-30 7:42 ` Dmitry Baryshkov
@ 2024-08-31 3:18 ` Bjorn Andersson
1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Andersson @ 2024-08-31 3:18 UTC (permalink / raw)
To: Maximilian Luz, Dan Carpenter
Cc: Konrad Dybcio, Johan Hovold, Ard Biesheuvel, linux-arm-msm,
linux-kernel, kernel-janitors
On Thu, 29 Aug 2024 22:23:04 +0300, Dan Carpenter wrote:
> If the __qcuefi pointer is not set, then in the original code, we would
> hold onto the lock. That means that if we tried to set it later, then
> it would cause a deadlock. Drop the lock on the error path. That's
> what all the callers are expecting.
>
>
Applied, thanks!
[1/1] firmware: qcom: uefisecapp: Fix deadlock in qcuefi_acquire()
commit: db213b0cfe3268d8b1d382b3bcc999c687a2567f
Best regards,
--
Bjorn Andersson <andersson@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-31 3:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-29 19:23 [PATCH] firmware: qcom: uefisecapp: Fix deadlock in qcuefi_acquire() Dan Carpenter
2024-08-30 7:42 ` Dmitry Baryshkov
2024-08-31 3:18 ` Bjorn Andersson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox