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] [day] [month] [year] [list]
Message-ID:
 <PAXPR04MB8510E6F1318202CD7F0A833288E72@PAXPR04MB8510.eurprd04.prod.outlook.com>
Date: Mon, 20 Jan 2025 01:47:15 +0000
From: Wei Fang <wei.fang@....com>
To: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@...il.com>, Shenwei Wang
	<shenwei.wang@....com>, Clark Wang <xiaoning.wang@....com>
CC: "andrew+netdev@...n.ch" <andrew+netdev@...n.ch>, "davem@...emloft.net"
	<davem@...emloft.net>, "edumazet@...gle.com" <edumazet@...gle.com>,
	"kuba@...nel.org" <kuba@...nel.org>, "pabeni@...hat.com" <pabeni@...hat.com>,
	"imx@...ts.linux.dev" <imx@...ts.linux.dev>, "netdev@...r.kernel.org"
	<netdev@...r.kernel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2 net-next] net: fec: implement TSO descriptor cleanup

> Implement cleanup of descriptors in the TSO error path of
> fec_enet_txq_submit_tso(). The cleanup
> 
> - Unmaps DMA buffers for data descriptors skipping TSO header
> - Clears all buffer descriptors
> - Handles extended descriptors by clearing cbd_esc when enabled
> 
> Signed-off-by: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@...il.com>
> ---
> Changelog:
> 
> v2
> 	- Add DMA unmapping for data descriptors
> 	- Handle extended descriptor (bufdesc_ex) cleanup
> 	- Move variable declarations to function scope
> 
>  drivers/net/ethernet/freescale/fec_main.c | 29 ++++++++++++++++++++++-
>  1 file changed, 28 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/freescale/fec_main.c
> b/drivers/net/ethernet/freescale/fec_main.c
> index 68725506a095..acd381710f87 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -840,6 +840,8 @@ static int fec_enet_txq_submit_tso(struct
> fec_enet_priv_tx_q *txq,
>  	struct fec_enet_private *fep = netdev_priv(ndev);
>  	int hdr_len, total_len, data_left;
>  	struct bufdesc *bdp = txq->bd.cur;
> +	struct bufdesc *tmp_bdp;
> +	struct bufdesc_ex *ebdp;
>  	struct tso_t tso;
>  	unsigned int index = 0;
>  	int ret;
> @@ -913,7 +915,32 @@ static int fec_enet_txq_submit_tso(struct
> fec_enet_priv_tx_q *txq,
>  	return 0;
> 
>  err_release:
> -	/* TODO: Release all used data descriptors for TSO */
> +	/* Release all used data descriptors for TSO */
> +	tmp_bdp = txq->bd.cur;
> +
> +	while (tmp_bdp != bdp) {
> +		/* Unmap data buffers */
> +		if (tmp_bdp->cbd_bufaddr && tmp_bdp != txq->bd.cur)

All the TSO headers will be unmapped except the first one. So please
use the following check condition.

if (!IS_TSO_HEADER(txq, fec32_to_cpu(tmp_bdp->cbd_bufaddr)))

BTW, the net-next is closed until Feb 3rd. And I think this is a
bug fix not a new feature, so you can change the target to net
tree and a Fixes tag, thanks.

> +			dma_unmap_single(&fep->pdev->dev,
> +					 tmp_bdp->cbd_bufaddr,
> +					 tmp_bdp->cbd_datlen,
> +					 DMA_TO_DEVICE);
> +
> +		/* Clear standard buffer descriptor fields */
> +		tmp_bdp->cbd_sc = 0;
> +		tmp_bdp->cbd_datlen = 0;
> +		tmp_bdp->cbd_bufaddr = 0;
> +
> +		/* Handle extended descriptor if enabled */
> +		if (fep->bufdesc_ex) {
> +			ebdp = (struct bufdesc_ex *)tmp_bdp;
> +			ebdp->cbd_esc = 0;
> +		}
> +
> +		tmp_bdp = fec_enet_get_nextdesc(tmp_bdp, &txq->bd);
> +	}
> +
> +	dev_kfree_skb_any(skb);
>  	return ret;
>  }
> 
> --
> 2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ