]> git.baikalelectronics.ru Git - kernel.git/commit
net: introduce device min_header_len
authorWillem de Bruijn <willemb@google.com>
Tue, 7 Feb 2017 20:57:20 +0000 (15:57 -0500)
committerDavid S. Miller <davem@davemloft.net>
Wed, 8 Feb 2017 18:56:37 +0000 (13:56 -0500)
commit619ac4f7f521eda28139a1e93e41b5c08b2c5b17
tree1964e4821fd14a8255df061419fc2e8745bc92e7
parent3c7edef59c811466e1090e997bbab1facfe27820
net: introduce device min_header_len

The stack must not pass packets to device drivers that are shorter
than the minimum link layer header length.

Previously, packet sockets would drop packets smaller than or equal
to dev->hard_header_len, but this has false positives. Zero length
payload is used over Ethernet. Other link layer protocols support
variable length headers. Support for validation of these protocols
removed the min length check for all protocols.

Introduce an explicit dev->min_header_len parameter and drop all
packets below this value. Initially, set it to non-zero only for
Ethernet and loopback. Other protocols can follow in a patch to
net-next.

Fixes: 92ea7b687a6c ("packet: validate variable length ll headers")
Reported-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Acked-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/loopback.c
include/linux/netdevice.h
net/ethernet/eth.c