[PATCH] net/mlx5: fix the unlock mismatch issue
Weiguo Li
liwg06 at foxmail.com
Sat Nov 4 05:07:33 CET 2023
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 at dpdk.org
Signed-off-by: Weiguo Li <liweiguo at 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
More information about the stable
mailing list