Skip to contentSkip to conversation

crypto: octeontx2 - fix missing unlock

PATCH In review Yang Yingliang 2 participants 2 messages Feb 25, 2022 – Mar 2, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: octeontx2 - fix missing unlock

Add the missing unlock before return from error path.

Fixes 4363f3d3ce8f ("crypto: octeontx2 - add synchronization between mailbox accesses")
---
 drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c | 4 +++-
 drivers/crypto/marvell/octeontx2/otx2_cptpf_mbox.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c +3 -1
index 17a9dd20c8c3..a402ccfac557 100644
@@ -143,8 +143,10 @@ static void cptpf_flr_wq_handler(struct work_struct *work)
 	mutex_lock(&pf->lock);
 	req = otx2_mbox_alloc_msg_rsp(mbox, 0, sizeof(*req),
 				      sizeof(struct msg_rsp));
-	if (!req)
+	if (!req) {
+		mutex_unlock(&pf->lock);
 		return;
+	}
 
 	req->sig = OTX2_MBOX_REQ_SIG;
 	req->id = MBOX_MSG_VF_FLR;
drivers/crypto/marvell/octeontx2/otx2_cptpf_mbox.c +3 -1
index fee758b86d29..dee0aa60b698 100644
@@ -20,8 +20,10 @@ static int forward_to_af(struct otx2_cptpf_dev *cptpf,
 
 	mutex_lock(&cptpf->lock);
 	msg = otx2_mbox_alloc_msg(&cptpf->afpf_mbox, 0, size);
-	if (msg == NULL)
+	if (msg == NULL) {
+		mutex_unlock(&cptpf->lock);
 		return -ENOMEM;
+	}
 
 	memcpy((uint8_t *)msg + sizeof(struct mbox_msghdr),
 	       (uint8_t *)req + sizeof(struct mbox_msghdr), size);
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 9 lines · Yang Yingliang

Add the missing unlock before return from error path.

Fixes 4363f3d3ce8f ("crypto: octeontx2 - add synchronization between mailbox accesses")
---
 drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c | 4 +++-
 drivers/crypto/marvell/octeontx2/otx2_cptpf_mbox.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt