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: <ZS2vX9cUAbpx9X3t@shell.armlinux.org.uk>
Date: Mon, 16 Oct 2023 22:47:11 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Eric Dumazet <edumazet@...gle.com>
Cc: Miquel Raynal <miquel.raynal@...tlin.com>, Wei Fang <wei.fang@....com>,
	Shenwei Wang <shenwei.wang@....com>,
	Clark Wang <xiaoning.wang@....com>, davem@...emloft.net,
	kuba@...nel.org, pabeni@...hat.com, linux-imx@....com,
	netdev@...r.kernel.org,
	Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
	Alexandre Belloni <alexandre.belloni@...tlin.com>,
	Maxime Chevallier <maxime.chevallier@...tlin.com>,
	Andrew Lunn <andrew@...n.ch>,
	Stephen Hemminger <stephen@...workplumber.org>
Subject: Re: Ethernet issue on imx6

On Mon, Oct 16, 2023 at 09:37:58PM +0200, Eric Dumazet wrote:
> diff --git a/drivers/net/ethernet/freescale/fec_main.c
> b/drivers/net/ethernet/freescale/fec_main.c
> index 77c8e9cfb44562e73bfa89d06c5d4b179d755502..520436d579d66cc3263527373d754a206cb5bcd6
> 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -753,7 +753,6 @@ fec_enet_txq_put_hdr_tso(struct fec_enet_priv_tx_q *txq,
>         struct fec_enet_private *fep = netdev_priv(ndev);
>         int hdr_len = skb_tcp_all_headers(skb);
>         struct bufdesc_ex *ebdp = container_of(bdp, struct bufdesc_ex, desc);
> -       void *bufaddr;
>         unsigned long dmabuf;
>         unsigned short status;
>         unsigned int estatus = 0;
> @@ -762,11 +761,11 @@ fec_enet_txq_put_hdr_tso(struct fec_enet_priv_tx_q *txq,
>         status &= ~BD_ENET_TX_STATS;
>         status |= (BD_ENET_TX_TC | BD_ENET_TX_READY);
> 
> -       bufaddr = txq->tso_hdrs + index * TSO_HEADER_SIZE;
>         dmabuf = txq->tso_hdrs_dma + index * TSO_HEADER_SIZE;
> -       if (((unsigned long)bufaddr) & fep->tx_align ||
> -               fep->quirks & FEC_QUIRK_SWAP_FRAME) {
> -               memcpy(txq->tx_bounce[index], skb->data, hdr_len);
> +       if (fep->quirks & FEC_QUIRK_SWAP_FRAME) {
> +               void *bufaddr = txq->tso_hdrs + index * TSO_HEADER_SIZE;
> +
> +               memcpy(txq->tx_bounce[index], bufaddr, hdr_len);
>                 bufaddr = txq->tx_bounce[index];
> 
>                 if (fep->quirks & FEC_QUIRK_SWAP_FRAME)

I'm not sure this has any effect on the reported issue.

1. For imx6 based devices, FEC_QUIRK_SWAP_FRAME is not set.
2. fep->tx_align is 15, TSO_HEADER_SIZE is 256, and ->tso_hdrs is
   derived from dma_alloc_coherent() which will be page aligned.
   So this condition will also always be false.

So, while the patch looks correct to me, I think it will only have an
effect on imx28 based systems that set FEC_QUIRK_SWAP_FRAME, and for
that it looks correct to me, since the header is always located in
txq->tso_hdrs and we need to copy it from there into the "bounce"
buffer.

Reviewed-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>

Thanks!

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ