For a CHECKSUM_COMPLETE skb, pskb_trim_rcsum() subtracts the checksum of the bytes it trims from skb->csum. It gets that checksum from skb_checksum(), so if the trimmed range runs into unreadable frags in a frag_list member, or past the end of the skb, it subtracts 0 and leaves skb->csum covering bytes that are no longer in the packet. pskb_trim_rcsum() can already fail, and its callers drop the packet when it does. Use skb_checksum_full() and return its error. Assisted-by: LLM Signed-off-by: Josef Bacik --- net/core/skbuff.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 88ed2dd99dc0..de433d452939 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -2829,9 +2829,13 @@ static int pskb_trim_rcsum_complete(struct sk_buff *skb, unsigned int len) int delta = skb->len - len; if (skb_frags_readable(skb)) { - skb->csum = csum_block_sub(skb->csum, - skb_checksum(skb, len, delta, 0), - len); + __wsum csum = 0; + int err; + + err = skb_checksum_full(skb, len, delta, &csum); + if (err) + return err; + skb->csum = csum_block_sub(skb->csum, csum, len); return 0; } -- 2.55.0