]> git.karo-electronics.de Git - karo-tx-linux.git/commit
packet: only allow extra vlan len on ethernet devices
authorDaniel Borkmann <daniel@iogearbox.net>
Wed, 11 Nov 2015 22:25:42 +0000 (23:25 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 15 Nov 2015 23:00:35 +0000 (18:00 -0500)
commit3c70c132488794e2489ab045559b0ce0afcf17de
tree7d48a54696aaa56ab9db32fb8e04b57cfcfae3de
parent8fd6c80d9dd938ca338c70698533a7e304752846
packet: only allow extra vlan len on ethernet devices

Packet sockets can be used by various net devices and are not
really restricted to ARPHRD_ETHER device types. However, when
currently checking for the extra 4 bytes that can be transmitted
in VLAN case, our assumption is that we generally probe on
ARPHRD_ETHER devices. Therefore, before looking into Ethernet
header, check the device type first.

This also fixes the issue where non-ARPHRD_ETHER devices could
have no dev->hard_header_len in TX_RING SOCK_RAW case, and thus
the check would test unfilled linear part of the skb (instead
of non-linear).

Fixes: 57f89bfa2140 ("network: Allow af_packet to transmit +4 bytes for VLAN packets.")
Fixes: 52f1454f629f ("packet: allow to transmit +4 byte in TX_RING slot for VLAN case")
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