Re: [PATCH] skbuff: skb_segment, Update nfrags after calling zero copy functions

From: Mohamed Khalfella
Date: Tue Aug 29 2023 - 18:25:07 EST


On 2023-08-29 12:09:15 +0200, Eric Dumazet wrote:
> Another way to test this path for certain (without tcpdump having to race)
> is to add a temporary/debug patch like this one:
>
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index a298992060e6efdecb87c7ffc8290eafe330583f..20cc42be5e81cdca567515f2a886af4ada0fbe0a
> 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -1749,7 +1749,8 @@ int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask)
> int i, order, psize, new_frags;
> u32 d_off;
>
> - if (skb_shared(skb) || skb_unclone(skb, gfp_mask))
> + if (skb_shared(skb) ||
> + pskb_expand_head(skb, 0, 0, gfp_mask))
> return -EINVAL;
>
> if (!num_frags)
>
> Note that this might catch other bugs :/

I was not able to make it allocate a new frags by running tcpdump while
reproing the problem. However, I was able to do it with your patch.