Re: [PATCH net v2] net: skbuff: make skb_copy_and_csum_bits() report unreadable frags

From: David Laight

Date: Wed Oct 14 2026 - 08:54:02 EST


On Tue, 13 Oct 2026 18:02:44 +0000
Josef Bacik <josef@xxxxxxxxxxxxxx> wrote:

> Subject: [PATCH net v2] net: skbuff: make skb_copy_and_csum_bits() report unreadable frags
> Date: Tue, 13 Oct 2026 18:02:44 +0000
>
> skb_copy_and_csum_bits() has no way to fail. When it reaches
> unreadable frags it zero-fills the rest of the buffer and returns 0,
> and since commit ab9414ed70bd ("net: skbuff: don't leave stale bytes in
> skb_copy_and_csum_bits()") that 0 is the correct checksum for what's in
> the buffer. Its callers can't tell the copy didn't happen.

Can't you use that fact that the csum function should only return
either 0 or ~0 and use the other value to indicate an error.

ISTR this coming up before with the 'copy_to/from_user_and_csum' code.

David