packet: reset network header if packet shorter than ll reserved space
authorWillem de Bruijn <willemb@google.com>
Wed, 11 Jul 2018 16:00:45 +0000 (12:00 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 24 Aug 2018 11:09:17 +0000 (13:09 +0200)
commit75425326b88ccdbcdecc652b1f6f672c0bd286d0
tree0ad4ab2efe6ebfe51c88014743baa0fe56c6cc04
parentedf81993dc293d9048fce2076a0b9182cd6ac07e
packet: reset network header if packet shorter than ll reserved space

[ Upstream commit 993675a3100b16a4c80dfd70cbcde8ea7127b31d ]

If variable length link layer headers result in a packet shorter
than dev->hard_header_len, reset the network header offset. Else
skb->mac_len may exceed skb->len after skb_mac_reset_len.

packet_sendmsg_spkt already has similar logic.

Fixes: b84bbaf7a6c8 ("packet: in packet_snd start writing at link layer allocation")
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/packet/af_packet.c