]> git.baikalelectronics.ru Git - kernel.git/commit
packet: fix tpacket_snd max frame len
authorDaniel Borkmann <daniel@iogearbox.net>
Wed, 11 Nov 2015 22:25:44 +0000 (23:25 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 15 Nov 2015 23:00:35 +0000 (18:00 -0500)
commit9310bfd41fc6940e03ea5f431fbba6cacfa6aaa0
treedb5aba8f1e47af35a7557bff779b80a1a0daadbc
parent337f8dabd116b03d0ff94d5418a0174456c2150c
packet: fix tpacket_snd max frame len

Since it's introduction in commit a3cedbd38534 ("net: TX_RING and
packet mmap"), TX_RING could be used from SOCK_DGRAM and SOCK_RAW
side. When used with SOCK_DGRAM only, the size_max > dev->mtu +
reserve check should have reserve as 0, but currently, this is
unconditionally set (in it's original form as dev->hard_header_len).

I think this is not correct since tpacket_fill_skb() would then
take dev->mtu and dev->hard_header_len into account for SOCK_DGRAM,
the extra VLAN_HLEN could be possible in both cases. Presumably, the
reserve code was copied from packet_snd(), but later on missed the
check. Make it similar as we have it in packet_snd().

Fixes: a3cedbd38534 ("net: TX_RING and packet mmap")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/packet/af_packet.c