xsk_skb_metadata() sets the u16 skb->csum_start to hr + csum_start. With 64K pages, csum_start can be close to U16_MAX, so the sum can overflow. The checksum offset then becomes negative. With XDP_UMEM_TX_SW_CSUM, skb_checksum_help() triggers a warning. Without it, the device gets a CHECKSUM_PARTIAL skb with a negative offset. Reject this with -EINVAL. Use the limit of skb_partial_csum_set(), which also rejects U16_MAX, the "not set" value of transport_header. That helper cannot be used here, as the skb built for an IFF_TX_SKB_NO_LINEAR device has no linear data. Fixes: 48eb03dd2630 ("xsk: Add TX timestamp and TX checksum offload support") Reported-by: Sashiko Closes: https://lore.kernel.org/all/sashiko-outbox-203545@kernel.org/ Signed-off-by: Tianyi Gao --- Sashiko reported this in [1], and earlier in [2][3]. Returning -EINVAL leaves the descriptor in the TX ring, as the current check does [2]. That is a separate issue and out of scope here. There is no selftest. The umem chunk size is at most PAGE_SIZE, so only a 64K-page kernel can hit this. [1] https://lore.kernel.org/all/sashiko-outbox-203545@kernel.org/ [2] https://lore.kernel.org/all/20260518063407.C3B99C2BCB7@smtp.kernel.org/ [3] https://lore.kernel.org/all/20260531042721.DBD4B1F00893@smtp.kernel.org/ net/xdp/xsk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index f22f9a2cdbbe..ab2e4fa87a4f 100644 --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c @@ -1006,7 +1006,8 @@ static int xsk_skb_metadata(struct sk_buff *skb, void *buffer, csum_offset = READ_ONCE(meta->request.csum_offset); if (unlikely(csum_start + csum_offset + - sizeof(__sum16) > desc->len)) + sizeof(__sum16) > desc->len || + hr + csum_start >= U16_MAX)) return -EINVAL; skb->csum_start = hr + csum_start; base-commit: aa40afa831ebfe45e40a23721711059f2ac584d4 -- 2.56.0