net/mlx5: fix mutex unlock in txpp cleanup
PATCH v4 1/1 net/mlx5: fix mutex unlock in txpp cleanup
The lock sh->txpp.mutex was not correctly released if the function returned in these two branches, which may led to deadlock if the function was acquired again.
Fixes d133f4cdb7 ("net/mlx5: create clock queue for packet pacing")
Signed-off-by Chengfeng Ye <[email protected]>
--- drivers/net/mlx5/mlx5_txpp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_txpp.c +5 -1
@@ -961,8 +961,12 @@ mlx5_txpp_stop(struct rte_eth_dev *dev)MLX5_ASSERT (!ret);RTE_SET_USED (ret);MLX5_ASSERT (sh->txpp.refcnt); -if (!sh->txpp.refcnt || --sh->txpp.refcnt) +if (!sh->txpp.refcnt || --sh->txpp.refcnt) { + ret =pthread_mutex_unlock (&sh->txpp.mutex); +MLX5_ASSERT (!ret); +RTE_SET_USED (ret);return ; + }/* No references any more, do actual destroy. */ mlx5_txpp_destroy (sh); ret =pthread_mutex_unlock (&sh->txpp.mutex);
Signature · 1 line
2.17.1