Skip to content

Commit

Permalink
net/mlx5e: Release skb in case of failure in tc update skb
Browse files Browse the repository at this point in the history
[ Upstream commit a34ffec ]

In case of failure in tc update skb the packet is dropped
without freeing the skb.

Fixed by freeing the skb in case failure in tc update skb.

Fixes: d6d2778 ("net/mlx5: E-Switch, Restore chain id on miss")
Fixes: c756909 ("net/mlx5e: Add tc chains offload support for nic flows")
Signed-off-by: Maor Dickman <maord@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
dickmanmaor authored and gregkh committed Feb 10, 2021
1 parent c2b2c4d commit 6a5c3ba
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
Expand Up @@ -1262,8 +1262,10 @@ static void mlx5e_handle_rx_cqe(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe)
mlx5e_complete_rx_cqe(rq, cqe, cqe_bcnt, skb);

if (mlx5e_cqe_regb_chain(cqe))
if (!mlx5e_tc_update_skb(cqe, skb))
if (!mlx5e_tc_update_skb(cqe, skb)) {
dev_kfree_skb_any(skb);
goto free_wqe;
}

napi_gro_receive(rq->cq.napi, skb);

Expand Down Expand Up @@ -1316,8 +1318,10 @@ static void mlx5e_handle_rx_cqe_rep(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe)
if (rep->vlan && skb_vlan_tag_present(skb))
skb_vlan_pop(skb);

if (!mlx5e_rep_tc_update_skb(cqe, skb, &tc_priv))
if (!mlx5e_rep_tc_update_skb(cqe, skb, &tc_priv)) {
dev_kfree_skb_any(skb);
goto free_wqe;
}

napi_gro_receive(rq->cq.napi, skb);

Expand Down Expand Up @@ -1371,8 +1375,10 @@ static void mlx5e_handle_rx_cqe_mpwrq_rep(struct mlx5e_rq *rq, struct mlx5_cqe64

mlx5e_complete_rx_cqe(rq, cqe, cqe_bcnt, skb);

if (!mlx5e_rep_tc_update_skb(cqe, skb, &tc_priv))
if (!mlx5e_rep_tc_update_skb(cqe, skb, &tc_priv)) {
dev_kfree_skb_any(skb);
goto mpwrq_cqe_out;
}

napi_gro_receive(rq->cq.napi, skb);

Expand Down Expand Up @@ -1528,8 +1534,10 @@ static void mlx5e_handle_rx_cqe_mpwrq(struct mlx5e_rq *rq, struct mlx5_cqe64 *cq
mlx5e_complete_rx_cqe(rq, cqe, cqe_bcnt, skb);

if (mlx5e_cqe_regb_chain(cqe))
if (!mlx5e_tc_update_skb(cqe, skb))
if (!mlx5e_tc_update_skb(cqe, skb)) {
dev_kfree_skb_any(skb);
goto mpwrq_cqe_out;
}

napi_gro_receive(rq->cq.napi, skb);

Expand Down

0 comments on commit 6a5c3ba

Please sign in to comment.