esp4: add length check for UDP encapsulation
authorSabrina Dubroca <sd@queasysnail.net>
Mon, 25 Mar 2019 13:30:00 +0000 (14:30 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 May 2019 16:23:41 +0000 (18:23 +0200)
commit3716c26250997e5c78146c873094360a6d644df5
treeb389c6f3a0bd71d453a4a20a7bbb0ab425e71a73
parentd410ef75886a4efb3c49b8bacd8e3c295235e744
esp4: add length check for UDP encapsulation

[ Upstream commit 8dfb4eba4100e7cdd161a8baef2d8d61b7a7e62e ]

esp_output_udp_encap can produce a length that doesn't fit in the 16
bits of a UDP header's length field. In that case, we'll send a
fragmented packet whose length is larger than IP_MAX_MTU (resulting in
"Oversized IP packet" warnings on receive) and with a bogus UDP
length.

To prevent this, add a length check to esp_output_udp_encap and return
 -EMSGSIZE on failure.

This seems to be older than git history.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv4/esp4.c