Re: [PATCH IPV6 v3 1/1] ipv6: allocate enough headroom in ip6_finish_output2()

From: Vasily Averin
Date: Tue Jul 13 2021 - 08:31:17 EST


On 7/13/21 10:46 AM, Vasily Averin wrote:
>> + if (likely(nskb)) {
>> + if (skb->sk)
>> + skb_set_owner_w(skb, skb->sk);
>
> need to assign sk not to skb but to nskb
>
>> + consume_skb(skb);
>> + } else {
>> + kfree_skb(skb);

Please disread, I was wrong here.
> It is quite strange to call consume_skb() on one case and kfree_skb() in another one.
> We know that original skb was shared so we should not call kfree_skb here.
>
> Btw I've noticed similar problem in few other cases:
> in pptp_xmit, pvc_xmit, ip_vs_prepare_tunneled_skb
> they call consume_skb() in case of success and kfree_skb on error path.
> It looks like potential bug for me.