Subject: Re: macvlan: fix gso_max_size setting

From: Patrick McHardy <[email-masked]>
Date: Mon, 23 Nov 2009 23:33:05 +0100

David Miller wrote:
> From: Patrick McHardy <[email-masked]>
> Date: Mon, 23 Nov 2009 23:11:07 +0100
>
>   
>> David Miller wrote:
>>     
>>> From: Patrick McHardy <[email-masked]>
>>> Date: Mon, 23 Nov 2009 11:33:06 +0100
>>>
>>>   
>>>       
>>>> Fix macvlan gso_max_size setting. Based on net-next-2.6.git.
>>>>         
>>> Pretty serious defect, maybe net-2.6 material?
>>>       
>> Sure, please take it in net-2.6.
>>     
>
> Done, thanks.
>
>   
>>> If someone hits this, it's going to trigger something awful.
>>>       
>> Don't drivers simply drop the packet? Otherwise I think you
>> should be able to trigger the same problem using the TC mirred
>> action.
>>     
>
> I see nothing in the IXGBE driver's transmit code paths which guard
> against this.
>   

Perhaps we should simply fall back to software in that case.
Compile tested only.

net: fall back to software segmentation if skb length exceeds dev->gso_max_size

Signed-off-by: Patrick McHardy <[email-masked]>
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ffc3106..edd1e2b 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1943,7 +1943,8 @@ static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
 {
 	return skb_is_gso(skb) &&
 	       (!skb_gso_ok(skb, dev->features) ||
-		unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
+		unlikely(skb->ip_summed != CHECKSUM_PARTIAL) ||
+		unlikely(skb->len > dev->gso_max_size));
 }
 
 static inline void netif_set_gso_max_size(struct net_device *dev,