net/packet: clear RX owner on VNET header error
Subsystems (3)
PATCH 1/1 net/packet: clear RX owner on VNET header error
Commit 61fad6816fc1 ("net/packet: tpacket_rcv: avoid a producer race condition") added rx_owner_map and made tpacket_rcv() claim a V1 or V2 ring slot before converting the virtio-net header. If the conversion fails, the drop path leaves the slot claimed.
With a one-frame TPACKET_V2 ring, an unsupported UDP GSO packet leaves the only slot unavailable, so the ring also drops the next valid packet.
Clear the ownership bit on this error path. TPACKET_V3 already clears its block state here.
--- net/packet/af_packet.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/packet/af_packet.c +3 -1
@@ -2384,7 +2384,9 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, virtio_net_hdr_from_skb(skb, h.raw + macoff - sizeof(struct virtio_net_hdr), vio_le(), true, 0)) { -if (po->tp_version ==TPACKET_V3 ) +if (po->tp_version <=TPACKET_V2 ) +__clear_bit (slot_id, po->rx_ring.rx_owner_map); +else prb_clear_blk_fill_status (&po->rx_ring); goto drop_n_account; }
---
base-commit: e6b6078ea1731b05b3b552497b3bce4bf8b014ae
change-id: 20260913-b4-send-packet-vnet-32b47964a7cf
Best regards,
Signature · 1 line
Mark Amirkan <[email protected]>
Quoted 10 lines · Mark Amirkan via B4 Relay wrote:
From: Mark Amirkan <[email protected]>
Commit
61fad6816fc1("net/packet:tpacket_rcv: avoid a producer race condition") addedrx_owner_mapand madetpacket_rcv()claim a V1 or V2 ring slot before converting the virtio-net header. If the conversion fails, the drop path leaves the slot claimed.With a one-frame
TPACKET_V2ring, an unsupported UDP GSO packet leaves the only slot unavailable, so the ring also drops the next valid packet.
Quoted 7 lines
Clear the ownership bit on this error path.
TPACKET_V3already clears its block state here.Fixes 61fad6816fc1 ("net/packet: tpacket_rcv: avoid a producer race condition")Assisted-by SymbolicSigned-off-by Mark Amirkan <[email protected]>
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Sun, 13 Sep 2026 10:28:08 +0000 you wrote:
From: Mark Amirkan <[email protected]>
Commit
61fad6816fc1("net/packet:tpacket_rcv: avoid a producer race condition") addedrx_owner_mapand madetpacket_rcv()claim a V1 or V2 ring slot before converting the virtio-net header. If the conversion fails, the drop path leaves the slot claimed.[...]
Here is the summary with links:
- [net] net/packet: clear RX owner on VNET header error
https://git.kernel.org/netdev/net/c/33ff111d7ba3
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html