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]
Date:	Fri, 4 Dec 2015 08:28:42 +0100
From:	Giuseppe CAVALLARO <peppe.cavallaro@...com>
To:	"David S. Miller" <davem@...emloft.net>
CC:	<netdev@...r.kernel.org>
Subject: Re: [PATCH (net.git)] stmmac: fix resource management when resume

Hi David

This is the v2, sorry I missed it in the subject.

Re-based on top of net.git.

peppe

On 12/4/2015 7:21 AM, Giuseppe Cavallaro wrote:
> There is a memleak when suspend/resume this driver version.
> Currently the stmmac, during resume step, reallocates all the resources
> but they are not released when suspend.
> The patch is not to release these resources but the logic has been changed.
> In fact, it is not necessary to free and reallocate all from scratch
> because the memory data will be always preserved.
> As final solution, the patch just reinit the descriptors and the rx/tx
> pointers only when resume. Tested done on STi boxes.
>
> Reported-by: ZhengShunQian <zhengsq@...k-chips.com>
> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@...com>
> Cc: David S. Miller <davem@...emloft.net>
> ---
>   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |    9 ++++++---
>   1 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 3c6549a..a5b869e 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -3046,8 +3046,6 @@ int stmmac_suspend(struct net_device *ndev)
>   	priv->hw->dma->stop_tx(priv->ioaddr);
>   	priv->hw->dma->stop_rx(priv->ioaddr);
>
> -	stmmac_clear_descriptors(priv);
> -
>   	/* Enable Power down mode by programming the PMT regs */
>   	if (device_may_wakeup(priv->device)) {
>   		priv->hw->mac->pmt(priv->hw, priv->wolopts);
> @@ -3105,7 +3103,12 @@ int stmmac_resume(struct net_device *ndev)
>
>   	netif_device_attach(ndev);
>
> -	init_dma_desc_rings(ndev, GFP_ATOMIC);
> +	priv->cur_rx = 0;
> +	priv->dirty_rx = 0;
> +	priv->dirty_tx = 0;
> +	priv->cur_tx = 0;
> +	stmmac_clear_descriptors(priv);
> +
>   	stmmac_hw_setup(ndev, false);
>   	stmmac_init_tx_coalesce(priv);
>   	stmmac_set_rx_mode(ndev);
>

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