On Thu, May 3, 2018 at 6:58 PM, Eric Dumazet <eric.duma...@gmail.com> wrote:
>
>
> On 05/03/2018 05:33 PM, Alexander Duyck wrote:
>> From: Alexander Duyck <alexander.h.du...@intel.com>
>>
>> This patch makes it so that if a destructor is not present we avoid trying
>> to update the skb socket or any reference counting that would be associated
>> with the NULL socket and/or descriptor. By doing this we can support
>> traffic coming from another namespace without any issues.
>>
>> Signed-off-by: Alexander Duyck <alexander.h.du...@intel.com>
>> ---
>>  net/ipv4/udp_offload.c |   19 +++++++++++++------
>>  1 file changed, 13 insertions(+), 6 deletions(-)
>>
>> diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
>> index fd94bbb369b2..52760660d674 100644
>> --- a/net/ipv4/udp_offload.c
>> +++ b/net/ipv4/udp_offload.c
>> @@ -195,6 +195,7 @@ struct sk_buff *__udp_gso_segment(struct sk_buff 
>> *gso_skb,
>>       unsigned int sum_truesize = 0;
>>       struct udphdr *uh;
>>       unsigned int mss;
>> +     bool copy_dtor;
>>       __sum16 check;
>>       __be16 newlen;
>>
>> @@ -208,12 +209,14 @@ struct sk_buff *__udp_gso_segment(struct sk_buff 
>> *gso_skb,
>>       skb_pull(gso_skb, sizeof(*uh));
>>
>>       /* clear destructor to avoid skb_segment assigning it to tail */
>> -     WARN_ON_ONCE(gso_skb->destructor != sock_wfree);
>> +     copy_dtor = gso_skb->destructor == sock_wfree;
>> +     WARN_ON_ONCE(gso_skb->destructor && !copy_dtor);
>
> Why not simply clear gso_skb->destructor only if copy_dtor is true ?
>
> Then we can get rid of this WARN_ON_ONCE()

Sounds good. I think I had code similar to that in an earlier version
of this patch, but when I started breaking things up I got rid of this
code until I realized I needed it due to a kernel panic triggered by
running the offload over a VXLAN from another namespace.

Thanks.

- Alex

Reply via email to