net/mlx5e: Verify inline header size do not exceed SKB linear size
authorEran Ben Elisha <eranbe@mellanox.com>
Thu, 25 Jan 2018 09:18:09 +0000 (11:18 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Mar 2018 06:41:16 +0000 (22:41 -0800)
commite7b316ac78e2cb5f7fc75df63cef92f0a1210537
treeaab8ad39ee5866ffbb474339ebc9c6d4edcd4c1b
parentcbd173b8105c259731c981849549b989c55624cf
net/mlx5e: Verify inline header size do not exceed SKB linear size

[ Upstream commit f600c6088018d1dbc5777d18daa83660f7ea4a64 ]

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: 6aace17e64f4 ("net/mlx5e: Fix inline header size for small packets")
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c