DPDK patches and discussions
 help / color / mirror / Atom feed
From: Weiguo Li <liwg06@foxmail.com>
To: akozyrev@nvidia.com
Cc: viacheslavo@nvidia.com, dev@dpdk.org, stable@dpdk.org,
	Weiguo Li <liweiguo@xencore.cn>
Subject: [PATCH] net/mlx5: fix the unlock mismatch issue
Date: Sat,  4 Nov 2023 12:07:33 +0800	[thread overview]
Message-ID: <tencent_D1651EC7D3B588081DFD6FF1112691E61807@qq.com> (raw)

The 'need_lock' parameter controls whether the function acquires and
releases the spinlock, but the first unlock operation occurs regardless
of the 'need_lock' parameter.

To fix this issue, the spin unlock operation should be invoked within
an 'if (need_lock)' block, ensuring that the function only unlocks the
spinlock if it has previously been acquired.

Fixes: 48fbb0e93d06 ("net/mlx5: support flow meter mark indirect action with HWS")
Cc: stable@dpdk.org

Signed-off-by: Weiguo Li <liweiguo@xencore.cn>
---
 drivers/net/mlx5/mlx5_flow_aso.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow_aso.c b/drivers/net/mlx5/mlx5_flow_aso.c
index 3c08da0614..f311443472 100644
--- a/drivers/net/mlx5/mlx5_flow_aso.c
+++ b/drivers/net/mlx5/mlx5_flow_aso.c
@@ -932,7 +932,8 @@ mlx5_aso_mtr_completion_handle(struct mlx5_aso_sq *sq, bool need_lock)
 		rte_spinlock_lock(&sq->sqsl);
 	max = (uint16_t)(sq->head - sq->tail);
 	if (unlikely(!max)) {
-		rte_spinlock_unlock(&sq->sqsl);
+		if (need_lock)
+			rte_spinlock_unlock(&sq->sqsl);
 		return;
 	}
 	do {
-- 
2.34.1


             reply	other threads:[~2023-11-04  4:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-04  4:07 Weiguo Li [this message]
2023-11-07  6:52 ` Slava Ovsiienko
2023-11-12 14:23 ` Raslan Darawsheh

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=tencent_D1651EC7D3B588081DFD6FF1112691E61807@qq.com \
    --to=liwg06@foxmail.com \
    --cc=akozyrev@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=liweiguo@xencore.cn \
    --cc=stable@dpdk.org \
    --cc=viacheslavo@nvidia.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;
as well as URLs for NNTP newsgroup(s).