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: <VI1PR0401MB18552747CE0E0FF2C7E0E4C5FFBE0@VI1PR0401MB1855.eurprd04.prod.outlook.com>
Date:	Fri, 4 Mar 2016 09:29:52 +0000
From:	Fugang Duan <fugang.duan@....com>
To:	Troy Kisky <troy.kisky@...ndarydevices.com>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"davem@...emloft.net" <davem@...emloft.net>,
	"b38611@...escale.com" <b38611@...escale.com>
CC:	"fabio.estevam@...escale.com" <fabio.estevam@...escale.com>,
	"l.stach@...gutronix.de" <l.stach@...gutronix.de>,
	"andrew@...n.ch" <andrew@...n.ch>,
	"tremyfr@...il.com" <tremyfr@...il.com>,
	"linux@....linux.org.uk" <linux@....linux.org.uk>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	"laci@...ndarydevices.com" <laci@...ndarydevices.com>,
	"shawnguo@...nel.org" <shawnguo@...nel.org>,
	"johannes@...solutions.net" <johannes@...solutions.net>,
	"stillcompiling@...il.com" <stillcompiling@...il.com>,
	"sergei.shtylyov@...entembedded.com" 
	<sergei.shtylyov@...entembedded.com>,
	"arnd@...db.de" <arnd@...db.de>
Subject: RE: [PATCH net-next V2 07/16] net: fec: set cbd_sc without relying on
 previous value

From: Troy Kisky <troy.kisky@...ndarydevices.com> Sent: Thursday, February 25, 2016 8:37 AM
> To: netdev@...r.kernel.org; davem@...emloft.net; b38611@...escale.com
> Cc: fabio.estevam@...escale.com; l.stach@...gutronix.de; andrew@...n.ch;
> tremyfr@...il.com; linux@....linux.org.uk; linux-arm-
> kernel@...ts.infradead.org; laci@...ndarydevices.com; shawnguo@...nel.org;
> johannes@...solutions.net; stillcompiling@...il.com;
> sergei.shtylyov@...entembedded.com; arnd@...db.de; Troy Kisky
> <troy.kisky@...ndarydevices.com>
> Subject: [PATCH net-next V2 07/16] net: fec: set cbd_sc without relying on
> previous value
> 
> Relying on the wrap bit to stay valid once initialized when the controller also
> writes to this byte seems undesirable since we can easily know what the value
> should be.
> 
> Signed-off-by: Troy Kisky <troy.kisky@...ndarydevices.com>
> ---
>  drivers/net/ethernet/freescale/fec_main.c | 38 +++++++++----------------------
>  1 file changed, 11 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/fec_main.c
> b/drivers/net/ethernet/freescale/fec_main.c
> index 791f385..6ceb5f9 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -340,9 +340,8 @@ fec_enet_txq_submit_frag_skb(struct
> fec_enet_priv_tx_q *txq,
>  		bdp = fec_enet_get_nextdesc(bdp, &txq->bd);
>  		ebdp = (struct bufdesc_ex *)bdp;
> 
> -		status = fec16_to_cpu(bdp->cbd_sc);
> -		status &= ~BD_ENET_TX_STATS;
> -		status |= (BD_ENET_TX_TC | BD_ENET_TX_READY);
> +		status = BD_ENET_TX_TC | BD_ENET_TX_READY |
> +				((bdp == txq->bd.last) ? BD_SC_WRAP : 0);
>  		frag_len = skb_shinfo(skb)->frags[frag].size;
> 
>  		/* Handle the last BD specially */
> @@ -436,8 +435,6 @@ static int fec_enet_txq_submit_skb(struct
> fec_enet_priv_tx_q *txq,
>  	/* Fill in a Tx ring entry */
>  	bdp = txq->bd.cur;
>  	last_bdp = bdp;
> -	status = fec16_to_cpu(bdp->cbd_sc);
> -	status &= ~BD_ENET_TX_STATS;
> 
>  	/* Set buffer length and buffer pointer */
>  	bufaddr = skb->data;
> @@ -462,6 +459,8 @@ static int fec_enet_txq_submit_skb(struct
> fec_enet_priv_tx_q *txq,
>  		return NETDEV_TX_OK;
>  	}
> 
> +	status = BD_ENET_TX_TC | BD_ENET_TX_READY |
> +			((bdp == txq->bd.last) ? BD_SC_WRAP : 0);
>  	if (nr_frags) {
>  		last_bdp = fec_enet_txq_submit_frag_skb(txq, skb, ndev);
>  		if (IS_ERR(last_bdp)) {
> @@ -512,7 +511,6 @@ static int fec_enet_txq_submit_skb(struct
> fec_enet_priv_tx_q *txq,
>  	/* Send it on its way.  Tell FEC it's ready, interrupt when done,
>  	 * it's the last BD of the frame, and to put the CRC on the end.
>  	 */
> -	status |= (BD_ENET_TX_READY | BD_ENET_TX_TC);

This is completely error.  We have to prepare all BDs for frag skb, and then enable "READY" and "TC" bit for the first BD, otherwise uDMA copy un-correct data to fifo.

<snip>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ