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:17:41 +0000 (07:17 +0100)
commita200e439c08bd92415f45802dbd5f535e511fd43
tree107aa504f191fab58b1e0cd564a7c0e4c6cc80a0
parent5afc3791c83eae228d154f9e38a29f6bcdd233ef
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