diff mbox series

[v2,2/4] net/mlx5: fix missing validation of null pointer

Message ID c85536ec3c5ab40ef85f11ca0d175d15277f2a83.1556809050.git.dekelp@mellanox.com (mailing list archive)
State Superseded, archived
Delegated to: Shahaf Shuler
Headers show
Series net/mlx5: code cleanup in rx and tx files | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Dekel Peled May 2, 2019, 3:01 p.m. UTC
Function mlx5_rxq_ibv_release() is called in several places.
Before each call except one, the input parameter is validated to make
sure it is not null.

This patch adds the missing validation where it is missing.

Fixes: af4f09f28294 ("net/mlx5: prefix all functions with mlx5")
Cc: stable@dpdk.org

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
---
 drivers/net/mlx5/mlx5_rxq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Yongseok Koh May 2, 2019, 6:12 p.m. UTC | #1
> On May 2, 2019, at 8:01 AM, Dekel Peled <dekelp@mellanox.com> wrote:
> 
> Function mlx5_rxq_ibv_release() is called in several places.
> Before each call except one, the input parameter is validated to make
> sure it is not null.
> 
> This patch adds the missing validation where it is missing.
> 
> Fixes: af4f09f28294 ("net/mlx5: prefix all functions with mlx5")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dekel Peled <dekelp@mellanox.com>
> ---
> drivers/net/mlx5/mlx5_rxq.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
> index db8c340..c9c2a14 100644
> --- a/drivers/net/mlx5/mlx5_rxq.c
> +++ b/drivers/net/mlx5/mlx5_rxq.c
> @@ -617,7 +617,8 @@
> 		 */
> 		rxq_data = (*priv->rxqs)[i];
> 		rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq);
> -		mlx5_rxq_ibv_release(rxq_ctrl->ibv);
> +		if (rxq_ctrl->ibv)
> +			mlx5_rxq_ibv_release(rxq_ctrl->ibv);

Please take care of two more things.

1) In mlx5_rx_intr_disable(), 
mlx5_rxq_ibv_get() isn't paired with mlx5_rxq_ibv_release()
This would need a separate patch.

2) In mlx5_rx_intr_vec_disable()
Please fix the comment having the old name - priv_rx_intr_vec_enable().
This should be mlx5_rx_intr_vec_enable()
No need to have a separate patch. You can fix it in this patch.

With the change,
Acked-by: Yongseok Koh <yskoh@mellanox.com>


> 	}
> free:
> 	rte_intr_free_epoll_fd(intr_handle);
> -- 
> 1.8.3.1
>
diff mbox series

Patch

diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index db8c340..c9c2a14 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -617,7 +617,8 @@ 
 		 */
 		rxq_data = (*priv->rxqs)[i];
 		rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq);
-		mlx5_rxq_ibv_release(rxq_ctrl->ibv);
+		if (rxq_ctrl->ibv)
+			mlx5_rxq_ibv_release(rxq_ctrl->ibv);
 	}
 free:
 	rte_intr_free_epoll_fd(intr_handle);