net/mlx5e: Rx, Check ip headers sanity
authorSaeed Mahameed <saeedm@mellanox.com>
Mon, 23 Sep 2019 12:40:29 +0000 (12:40 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Oct 2019 06:26:04 +0000 (08:26 +0200)
commitb3873e34cbf2fb533091209aa1203338f66d5394
treebe5d0179b245c314eb8a60e1865b5ae72e02dd4f
parent404f118f27900fb4ebc2fccdac35b6dc6dd9a757
net/mlx5e: Rx, Check ip headers sanity

[ Upstream commit 0318a7b7fcad9765931146efa7ca3a034194737c ]

In the two places is_last_ethertype_ip is being called, the caller will
be looking inside the ip header, to be safe, add ip{4,6} header sanity
check. And return true only on valid ip headers, i.e: the whole header
is contained in the linear part of the skb.

Note: Such situation is very rare and hard to reproduce, since mlx5e
allocates a large enough headroom to contain the largest header one can
imagine.

Fixes: fe1dc069990c ("net/mlx5e: don't set CHECKSUM_COMPLETE on SCTP packets")
Reported-by: Cong Wang <xiyou.wangcong@gmail.com>
Reviewed-by: Tariq Toukan <tariqt@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_rx.c