net/packet: tpacket_rcv: do not increment ring index on drop
authorWillem de Bruijn <willemb@google.com>
Mon, 9 Mar 2020 15:34:35 +0000 (11:34 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Mar 2020 06:14:12 +0000 (07:14 +0100)
commit64fabf9bcadfb93fb21fb023a72a2ad8b7a40047
treeb321d7db35e8b4fef67b308939d0cbeef84af023
parent7e78a7fdcc8d8c854e5dc8441a452baca24dec67
net/packet: tpacket_rcv: do not increment ring index on drop

[ Upstream commit 46e4c421a053c36bf7a33dda2272481bcaf3eed3 ]

In one error case, tpacket_rcv drops packets after incrementing the
ring producer index.

If this happens, it does not update tp_status to TP_STATUS_USER and
thus the reader is stalled for an iteration of the ring, causing out
of order arrival.

The only such error path is when virtio_net_hdr_from_skb fails due
to encountering an unknown GSO type.

Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/packet/af_packet.c