From: Dan Carpenter <dan.carpenter@linaro.org>
To: Maximilian Luz <luzmaximilian@gmail.com>
Cc: Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Johan Hovold <johan+linaro@kernel.org>,
Ard Biesheuvel <ardb@kernel.org>,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [PATCH] firmware: qcom: uefisecapp: Fix deadlock in qcuefi_acquire()
Date: Thu, 29 Aug 2024 22:23:04 +0300 [thread overview]
Message-ID: <19829bc4-1b6f-47f7-847a-e90c25749e40@stanley.mountain> (raw)
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
next reply other threads:[~2024-08-29 19:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-29 19:23 Dan Carpenter [this message]
2024-08-30 7:42 ` [PATCH] firmware: qcom: uefisecapp: Fix deadlock in qcuefi_acquire() Dmitry Baryshkov
2024-08-31 3:18 ` Bjorn Andersson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19829bc4-1b6f-47f7-847a-e90c25749e40@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=andersson@kernel.org \
--cc=ardb@kernel.org \
--cc=johan+linaro@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=konradybcio@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luzmaximilian@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox