Skip to content

Commit

Permalink
net/mlx5e: Verify inline header size do not exceed SKB linear size
Browse files Browse the repository at this point in the history
Driver tries to copy at least MLX5E_MIN_INLINE bytes into the control
segment of the WQE. It assumes that the linear part contains at least
MLX5E_MIN_INLINE bytes, which can be wrong.

Cited commit verified that driver will not copy more bytes into the
inline header part that the actual size of the packet. Re-factor this
check to make sure we do not exceed the linear part as well.

This fix is aligned with the current driver's assumption that the entire
L2 will be present in the linear part of the SKB.

Fixes: 6aace17 ("net/mlx5e: Fix inline header size for small packets")
Signed-off-by: Eran Ben Elisha <[email protected]>
Signed-off-by: Saeed Mahameed <[email protected]>
  • Loading branch information
Eran Ben Elisha authored and Saeed Mahameed committed Feb 20, 2018
1 parent ef7a351 commit f600c60
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static inline u16 mlx5e_calc_min_inline(enum mlx5_inline_modes mode,
default:
hlen = mlx5e_skb_l2_header_offset(skb);
}
return min_t(u16, hlen, skb->len);
return min_t(u16, hlen, skb_headlen(skb));
}

static inline void mlx5e_tx_skb_pull_inline(unsigned char **skb_data,
Expand Down

0 comments on commit f600c60

Please sign in to comment.