[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <19829bc4-1b6f-47f7-847a-e90c25749e40@stanley.mountain>
Date: Thu, 29 Aug 2024 22:23:04 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Maximilian Luz <luzmaximilian@...il.com>
Cc: Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konradybcio@...nel.org>,
Johan Hovold <johan+linaro@...nel.org>,
Ard Biesheuvel <ardb@...nel.org>, linux-arm-msm@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH] firmware: qcom: uefisecapp: Fix deadlock in qcuefi_acquire()
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@...aro.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
Powered by blists - more mailing lists