]> git.baikalelectronics.ru Git - kernel.git/commit
net/packet: implement shortcut in tpacket_rcv()
authorEric Dumazet <edumazet@google.com>
Wed, 12 Jun 2019 16:52:31 +0000 (09:52 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 15 Jun 2019 01:52:14 +0000 (18:52 -0700)
commitba0d6ebaa939bc38146bd2bc3d1d32141c183059
tree5153110a521ecde10c1a23ee8fbeb79f495cd871
parent44ffdbead70fcdae43d9db351c01813db0d8a3d3
net/packet: implement shortcut in tpacket_rcv()

tpacket_rcv() can be hit under DDOS quite hard, since
it will always grab a socket spinlock, to eventually find
there is no room for an additional packet.

Using tcpdump [1] on a busy host can lead to catastrophic consequences,
because of all cpus spinning on a contended spinlock.

This replicates a similar strategy used in packet_rcv()

[1] Also some applications mistakenly use af_packet socket
bound to ETH_P_ALL only to send packets.
Receive queue is never drained and immediately full.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/packet/af_packet.c