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: <1365773328.4459.19.camel@edumazet-glaptop>
Date:	Fri, 12 Apr 2013 06:28:48 -0700
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Jeff Kirsher <jeffrey.t.kirsher@...el.com>
Cc:	davem@...emloft.net, Alexander Duyck <alexander.h.duyck@...el.com>,
	netdev@...r.kernel.org, gospo@...hat.com, sassmann@...hat.com
Subject: Re: [net-next 02/11] ixgbe: Mask off check of frag_off as we only
 want fragment offset

On Fri, 2013-04-12 at 04:24 -0700, Jeff Kirsher wrote:
> From: Alexander Duyck <alexander.h.duyck@...el.com>
> 
> We were incorrectly checking the entire frag_off field when we only wanted the
> fragment offset.  As a result we were not pulling in TCP headers when the DNF
> flag was set.
> 
> To correct that we will now check for frag off using the IP_OFFSET mask.
> 
> Signed-off-by: Alexander Duyck <alexander.h.duyck@...el.com>
> Tested-by: Phil Schmitt <phillip.j.schmitt@...el.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@...el.com>
> ---
>  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index 0c51a9f..096a221 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -1347,7 +1347,7 @@ static unsigned int ixgbe_get_headlen(unsigned char *data,
>  			return hdr.network - data;
>  
>  		/* record next protocol if header is present */
> -		if (!hdr.ipv4->frag_off)
> +		if (!(hdr.ipv4->frag_off & htons(IP_OFFSET)))
>  			nexthdr = hdr.ipv4->protocol;
>  	} else if (protocol == __constant_htons(ETH_P_IPV6)) {
>  		if ((hdr.network - data) > (max_len - sizeof(struct ipv6hdr)))

I wonder if you could use core functions instead of all this...

A simple wrapper would be :

static noinline unsigned int ixgbe_get_headlen(unsigned char *data,
						u32 maxlen)
{
    struct skb fake;
    unsigned int res;

    fake->data = data;
    fake->head = data;
    fake->data_len = 0;
    fake->len = maxlen;
    skb_reset_network_header(&fake);
    res = __skb_get_poff(&fake);
    return res ?: maxlen;
}

(completely untested)


--
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