Subject: Re: [PATCH net-next] udp: Fix kernel panic in UDP GSO path

From: [email-masked]
Date: Mon, 14 May 2018 16:45:57 -0600

On 2018-05-11 17:16, Willem de Bruijn wrote:

>> Hmm, no, we absolutely need to fix GSO instead.
>> 
>> Think of a bonding device (or any virtual devices), your patch wont 
>> avoid the crash.

Hi Eric. Can you clarify what you mean by "fix GSO?" Is that just having 
the GSO path work
regardless of whether or not SG is enabled for the device?

> 
> Thanks for reporting the issue.
> 
> Paged skbuffs is an optimization for gso, but the feature should
> continue to work even if gso skbs are linear, indeed (if at the cost
> of copying during skb_segment).
> 
> We need to make paged contingent on scatter-gather. Rough
> patch below. That is for ipv4 only, the same will be needed for ipv6.
> 
> diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
> index b5e21eb198d8..b38731d8a44f 100644
> --- a/net/ipv4/ip_output.c
> +++ b/net/ipv4/ip_output.c
> @@ -884,7 +884,7 @@ static int __ip_append_data(struct sock *sk,
> 
>         exthdrlen = !skb ? rt->dst.header_len : 0;
>         mtu = cork->gso_size ? IP_MAX_MTU : cork->fragsize;
> -       paged = !!cork->gso_size;
> +       paged = cork->gso_size && (rt->dst.dev->features & NETIF_F_SG);

Hi Willem. That's definitely a much cleaner patch than ours since it 
allows the GSO to continue without failure.
We tried it on both the IPv4 and IPv6 path and didn't see the crash in 
either case.

-----
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora 
Forum,
a Linux Foundation Collaborative Project