DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 1/2] bus/dpaa: fix lock condition during error handling
@ 2024-11-13 16:14 Hemant Agrawal
  2024-11-13 16:14 ` [PATCH 2/2] examples/l2fwd-event: fix spinlock handling Hemant Agrawal
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Hemant Agrawal @ 2024-11-13 16:14 UTC (permalink / raw)
  To: thomas, dev; +Cc: stephen, stable

The error handling is missing FQ unlock code.
Detected by pvr-studio
Bug 89-93: very suspicious synchronization
The analyzer issued a pack of V1020 warnings that a resource
might remain blocked.

Fixes: c47ff048b99a ("bus/dpaa: add QMAN driver core routines")
Cc: stable@dpdk.org

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/bus/dpaa/base/qbman/qman.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c
index 9c90ee25a6..c48fa3e073 100644
--- a/drivers/bus/dpaa/base/qbman/qman.c
+++ b/drivers/bus/dpaa/base/qbman/qman.c
@@ -2138,8 +2138,10 @@ int qman_set_vdq(struct qman_fq *fq, u16 num, uint32_t vdqcr_flags)
 
 	if (!p->vdqcr_owned) {
 		FQLOCK(fq);
-		if (fq_isset(fq, QMAN_FQ_STATE_VDQCR))
+		if (fq_isset(fq, QMAN_FQ_STATE_VDQCR)) {
+			FQUNLOCK(fq);
 			goto escape;
+		}
 		fq_set(fq, QMAN_FQ_STATE_VDQCR);
 		FQUNLOCK(fq);
 		p->vdqcr_owned = fq;
@@ -2172,8 +2174,10 @@ int qman_volatile_dequeue(struct qman_fq *fq, u32 flags __maybe_unused,
 
 	if (!p->vdqcr_owned) {
 		FQLOCK(fq);
-		if (fq_isset(fq, QMAN_FQ_STATE_VDQCR))
+		if (fq_isset(fq, QMAN_FQ_STATE_VDQCR)) {
+			FQUNLOCK(fq);
 			goto escape;
+		}
 		fq_set(fq, QMAN_FQ_STATE_VDQCR);
 		FQUNLOCK(fq);
 		p->vdqcr_owned = fq;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-11-18 18:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-13 16:14 [PATCH 1/2] bus/dpaa: fix lock condition during error handling Hemant Agrawal
2024-11-13 16:14 ` [PATCH 2/2] examples/l2fwd-event: fix spinlock handling Hemant Agrawal
2024-11-13 16:48 ` [PATCH 1/2] bus/dpaa: fix lock condition during error handling David Marchand
2024-11-14  7:45   ` Hemant Agrawal
2024-11-14  7:44 ` [PATCH v2 1/3] " Hemant Agrawal
2024-11-14  7:44   ` [PATCH v2 2/3] examples/l2fwd-event: fix spinlock handling Hemant Agrawal
2024-11-18  9:32     ` [EXTERNAL] " Jerin Jacob
2024-11-14  7:44   ` [PATCH v2 3/3] bus/dpaa: enabling clang thread safety for locks Hemant Agrawal
2024-11-18 18:06     ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).