[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <53ADBC8A.8070103@cogentembedded.com>
Date: Fri, 27 Jun 2014 22:48:42 +0400
From: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To: Russell King <rmk+kernel@....linux.org.uk>,
linux-arm-kernel@...ts.infradead.org, netdev@...r.kernel.org
CC: Fugang Duan <B38611@...escale.com>
Subject: Re: [PATCH CFT 12/30] net: fec: ensure fec_enet_free_buffers() properly
cleans the rings
Hello.
On 06/27/2014 07:19 PM, Russell King wrote:
> Ensure that we do not double-free any allocations, and that any transmit
> skbuffs are properly freed when we clean up the rings.
> Signed-off-by: Russell King <rmk+kernel@....linux.org.uk>
> ---
> drivers/net/ethernet/freescale/fec_main.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> index 9c5570a3e32e..8024b7a8e7f4 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -2079,8 +2079,14 @@ static void fec_enet_free_buffers(struct net_device *ndev)
> }
>
> bdp = fep->tx_bd_base;
> - for (i = 0; i < fep->tx_ring_size; i++)
> + for (i = 0; i < fep->tx_ring_size; i++) {
> kfree(fep->tx_bounce[i]);
> + fep->tx_bounce[i] = NULL;
> + skb = fep->tx_skbuff[i];
> + fep->tx_skbuff[i] = NULL;
> + if (skb)
> + dev_kfree_skb(skb);
dev_kfree_skb() (actually, consume_skb() that it calls) already checks
'skb' for NULL.
WBR, Sergei
--
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