packet: fix PACKET_TX_RING data corruption on skb_orphan
Status from this message: This series was applied to netdev/net.git (main)
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest2 patches 2 repliesApplied 2/2
- v12 patches 2 repliesSuperseded
Patches in v2 All 2 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | virtio_net: copy zerocopy frags in start_xmit without NAPIdrivers/ | +9 | 1 reply | Applied |
| 2/2 | packet: use ubuf_info completion for TX_RING packetsinclude/ net/ | +65 | 1 reply | Applied |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH net v2 0/2] packet: fix PACKET_TX_RING data corruption on skb_orphan
From: Willem de Bruijn <[email protected]>
When transmitting packets via PACKET_TX_RING, tpacket_snd links user ring buffer pages as skb frags and releases the slot on skb->destructor (tpacket_destruct_skb).
skb_orphan() invokes the destructor while the skb is still alive. This marks the slot as TP_STATUS_AVAILABLE prematurely, allowing userspace to overwrite the slot and causing data corruption.
This series fixes the issue by switching PACKET_TX_RING to standard ubuf_info zerocopy completion, ensuring ring slots are released only after all payload references are freed or copied.
Virtio-net needs a separate solution, because deferring the release can cause deadlock in its !use_napi mode.
- Patch 1 addresses the virtio-net special case.
- Patch 2 converts tpacket_snd to standard ubuf_info completion
Patch 1 must be applied, and backported, before patch 2. Both carry the same Fixes tag for that reason.
v1: https://lore.kernel.org/netdev/[email protected]/
Willem de Bruijn (2):
virtio_net: copy zerocopy frags in start_xmit without NAPI
packet: use ubuf_info completion for TX_RING packets
drivers/net/virtio_net.c | 9 ++++ include/linux/skbuff.h | 19 +------- net/packet/af_packet.c | 102 ++++++++++++++++++++++++--------------- 3 files changed, 74 insertions(+), 56 deletions(-)
Signature · 1 line
2.55.0.1082.g2b9226bbc0-goog