lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1300122105.3423.131.camel@edumazet-laptop>
Date:	Mon, 14 Mar 2011 18:01:45 +0100
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Daniel Lezcano <daniel.lezcano@...e.fr>
Cc:	davem@...emloft.net, kaber@...sh.net, nightnord@...il.com,
	netdev@...r.kernel.org
Subject: Re: [PATCH 2/2] dev : fix mtu check when TSO is enabled

Le lundi 14 mars 2011 à 17:08 +0100, Daniel Lezcano a écrit :
> In case the device where is coming from the packet has TSO enabled,
> we should not check the mtu size value as this one could be bigger
> than the expected value.
> 
> This is the case for the macvlan driver when the lower device has
> TSO enabled. The macvlan inherit this feature and forward the packets
> without fragmenting them. Then the packets go through dev_forward_skb
> and are dropped. This patch fix this by checking TSO is not enabled
> when we want to check the mtu size.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@...e.fr>
> Cc: Patrick McHardy <kaber@...sh.net>
> Cc: Andrian Nord <nightnord@...il.com>
> ---
>  net/core/dev.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 6561021..010a0a9 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1526,8 +1526,10 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
>  	skb_orphan(skb);
>  	nf_reset(skb);
>  
> -	if (unlikely(!(dev->flags & IFF_UP) ||
> -		     (skb->len > (dev->mtu + dev->hard_header_len + VLAN_HLEN)))) {
> +	if (unlikely(!(skb->dev->features & NETIF_F_TSO) &&


Sorry, this needs a comment at least, or even better a helper function
on its own.

We test both skb->dev & dev, pointing to different devices, this is
really error prone.

Are we sure all callers set skb->dev before calling  dev_forward_skb() ?


> +		     (!(dev->flags & IFF_UP) ||
> +		      (skb->len > (dev->mtu +
> +				   dev->hard_header_len + VLAN_HLEN))))) {
>  		atomic_long_inc(&dev->rx_dropped);
>  		kfree_skb(skb);
>  		return NET_RX_DROP;


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ