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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220318141207.284972b7@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date:   Fri, 18 Mar 2022 14:12:07 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Stéphane Graber <stgraber@...ntu.com>
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        Iyappan Subramanian <iyappan@...amperecomputing.com>,
        Keyur Chudgar <keyur@...amperecomputing.com>,
        Quan Nguyen <quan@...amperecomputing.com>,
        "David S . Miller" <davem@...emloft.net>,
        Toan Le <toan@...amperecomputing.com>, stable@...r.kernel.org
Subject: Re: [PATCH] drivers: net: xgene: Fix regression in CRC stripping

On Thu, 17 Mar 2022 10:42:25 -0400 Stéphane Graber wrote:
> From: Stephane Graber <stgraber@...ntu.com>
> 
> All packets on ingress (except for jumbo) are terminated with a 4-bytes
> CRC checksum. It's the responsability of the driver to strip those 4
> bytes. Unfortunately a change dating back to March 2017 re-shuffled some
> code and made the CRC stripping code effectively dead.
> 
> This change re-orders that part a bit such that the datalen is
> immediately altered if needed.
> 
> Fixes: 4902a92270fb ("drivers: net: xgene: Add workaround for errata 10GE_8/ENET_11")
> Signed-off-by: Stephane Graber <stgraber@...ntu.com>
> Tested-by: Stephane Graber <stgraber@...ntu.com>
> Cc: stable@...r.kernel.org
> ---
>  drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
> index ff2d099aab21..3892790f04e0 100644
> --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
> +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
> @@ -696,6 +696,12 @@ static int xgene_enet_rx_frame(struct xgene_enet_desc_ring *rx_ring,
>  	buf_pool->rx_skb[skb_index] = NULL;
>  
>  	datalen = xgene_enet_get_data_len(le64_to_cpu(raw_desc->m1));
> +
> +	/* strip off CRC as HW isn't doing this */
> +	nv = GET_VAL(NV, le64_to_cpu(raw_desc->m0));
> +	if (!nv)
> +		datalen -= 4;

Alternatively we could call skb_trim() below to remove the FCS.
You call, but..

>  	skb_put(skb, datalen);
>  	prefetch(skb->data - NET_IP_ALIGN);
>  	skb->protocol = eth_type_trans(skb, ndev);
> @@ -717,10 +723,7 @@ static int xgene_enet_rx_frame(struct xgene_enet_desc_ring *rx_ring,
>  		}
>  	}
>  
> -	nv = GET_VAL(NV, le64_to_cpu(raw_desc->m0));
>  	if (!nv) {
> -		/* strip off CRC as HW isn't doing this */
> -		datalen -= 4;
>  		goto skip_jumbo;
>  	}

If you stick to moving the datalen adjustments this if will have a
single statement so according to the kernel code style it has to lose
the brackets.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ