Skip to content

Commit

Permalink
net/mlx5: fix Rx/Tx queue checks
Browse files Browse the repository at this point in the history
[ upstream commit 94e257e ]

When device configuration was interrupted by a signal,
mlx5_rxq/txq_release() could access yet unitinialized array
and crash the application. Add checks whether queue array
is initialized.

Fixes: a1366b1 ("net/mlx5: add reference counter on DPDK Rx queues")
Fixes: 6e78005 ("net/mlx5: add reference counter on DPDK Tx queues")

Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
  • Loading branch information
dkozlyuk authored and cpaelzer committed Aug 10, 2021
1 parent 373eada commit a1b444b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/net/mlx5/mlx5_rxq.c
Expand Up @@ -2074,7 +2074,7 @@ mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx)
struct mlx5_priv *priv = dev->data->dev_private;
struct mlx5_rxq_ctrl *rxq_ctrl;

if (!(*priv->rxqs)[idx])
if (priv->rxqs == NULL || (*priv->rxqs)[idx] == NULL)
return 0;
rxq_ctrl = container_of((*priv->rxqs)[idx], struct mlx5_rxq_ctrl, rxq);
assert(rxq_ctrl->priv);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/mlx5/mlx5_txq.c
Expand Up @@ -1410,7 +1410,7 @@ mlx5_txq_release(struct rte_eth_dev *dev, uint16_t idx)
struct mlx5_priv *priv = dev->data->dev_private;
struct mlx5_txq_ctrl *txq;

if (!(*priv->txqs)[idx])
if (priv->txqs == NULL || (*priv->txqs)[idx] == NULL)
return 0;
txq = container_of((*priv->txqs)[idx], struct mlx5_txq_ctrl, txq);
if (txq->obj && !mlx5_txq_obj_release(txq->obj))
Expand Down

0 comments on commit a1b444b

Please sign in to comment.