wireguard: device: do not generate ICMP for non-IP packets
authorJason A. Donenfeld <Jason@zx2c4.com>
Mon, 22 Feb 2021 16:25:47 +0000 (17:25 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Mar 2021 10:38:18 +0000 (11:38 +0100)
commit2a33f6fb92063e29839f37f32c7063968f658391
tree21b6a440f41809fe74d8f01912f98a69c6445a69
parent3bbb8573ceb17dbd683db260cdf45e19b706617e
wireguard: device: do not generate ICMP for non-IP packets

[ Upstream commit 99fff5264e7ab06f45b0ad60243475be0a8d0559 ]

If skb->protocol doesn't match the actual skb->data header, it's
probably not a good idea to pass it off to icmp{,v6}_ndo_send, which is
expecting to reply to a valid IP packet. So this commit has that early
mismatch case jump to a later error label.

Fixes: e7096c131e51 ("net: WireGuard secure network tunnel")
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireguard/device.c