With XDP enabled, rx ring 0 head buffers are page_pool pages and the device is given a buffer length of MTU + 22 (skb_buf_size; the previous patch keeps the XDP MTU low enough for that). The device still accepts somewhat longer frames (observed: up to MTU + 26 untagged, MTU + 30 with a VLAN tag) and splits them over a head and a body descriptor. vmxnet3_rq_rx_complete() runs XDP only for completions with both sop and eop set. A frame with sop but without eop falls through to the skb path, which uses rbi->skb although, for a VMXNET3_RX_BUF_XDP buffer, that union member holds the page. The result is a kernel BUG in skb_put(), or at BUG_ON(ctx->skb != NULL || rbi->skb == NULL): kernel BUG at net/core/skbuff.c:2637! RIP: 0010:skb_put+0x3c/0x40 Call Trace: vmxnet3_rq_rx_complete+0x893/0x12b0 [vmxnet3] vmxnet3_poll_rx_only+0x38/0xd0 [vmxnet3] __napi_poll+0x2b/0x160 net_rx_action+0x336/0x420 One frame of MTU + 23 to MTU + 26 bytes from any host on the same L2 segment is enough to crash a guest that has a native XDP program attached to a vmxnet3 interface. XDP on vmxnet3 is single-buffer, so drop such frames: count them in drop_total, reuse the head buffer and skip the body buffers, as the existing allocation failure path does. The completions of one frame may span two polls, so start each poll with skip_page_frags set when no frame is in progress (rx_ctx.skb == NULL; the first patch of this series makes that hold for the data ring path too): a body buffer without a head can only belong to a dropped frame. If the last body buffer of a dropped frame has rcd->err set, do not count the frame a second time in vmxnet3_rx_error(). The problem was found and analysed, and this patch drafted, with the help of an AI coding assistant. It was reproduced and tested on the reporter's lab systems as described in the cover letter. Fixes: 54f00cce1178 ("vmxnet3: Add XDP support.") Signed-off-by: Philipp Sudakas --- drivers/net/vmxnet3/vmxnet3_drv.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index e8be95c..66f6773 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c @@ -1614,7 +1614,8 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq, adapter->rx_prod_offset, adapter->rx_prod2_offset }; u32 num_pkts = 0; - bool skip_page_frags = false; + /* A frame dropped at its head may continue in the next poll. */ + bool skip_page_frags = !rq->rx_ctx.skb; bool encap_lro = false; struct Vmxnet3_RxCompDesc *rcd; struct vmxnet3_rx_ctx *ctx = &rq->rx_ctx; @@ -1662,10 +1663,27 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq, rxd->len != rbi->len); if (unlikely(rcd->eop && rcd->err)) { + /* The last body buffer of a frame already dropped */ + if (!rcd->sop && skip_page_frags) + goto rcd_done; vmxnet3_rx_error(rq, rcd, ctx, adapter); goto rcd_done; } + if (rcd->sop && !rcd->eop && + rbi->buf_type == VMXNET3_RX_BUF_XDP && + !VMXNET3_RX_DATA_RING(adapter, rcd->rqID)) { + /* The frame did not fit one XDP buffer. XDP here is + * single-buffer and the head holds a page, not an + * skb: drop the frame, reuse the head buffer and + * skip the body buffers. + */ + rq->stats.drop_total++; + ctx->skb = NULL; + skip_page_frags = true; + goto rcd_done; + } + if (rcd->sop && rcd->eop && vmxnet3_xdp_enabled(adapter)) { struct sk_buff *skb_xdp_pass; int act; -- 2.47.3