From b28f6428af279ffb9e97ee00486a29498b7fcfdc Mon Sep 17 00:00:00 2001 From: Matt Carlson Date: Sat, 5 Jun 2010 17:24:32 +0000 Subject: [PATCH] tg3: Fix a memory leak on 5717+ devices The rx resources for MSI-X interrupt vector 0 were not being freed correctly. This happens because the teardown loop continue's to the next loop iteration if it detects the tx ring for that vector is not setup, thus bypassing the rx teardown code. This patch moves the call to tg3_rx_prodring_free() earlier in the loop. Signed-off-by: Matt Carlson Signed-off-by: Michael Chan Signed-off-by: David S. Miller --- drivers/net/tg3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 057e8ebc1b2..86f8798a88e 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -6229,6 +6229,8 @@ static void tg3_free_rings(struct tg3 *tp) for (j = 0; j < tp->irq_cnt; j++) { struct tg3_napi *tnapi = &tp->napi[j]; + tg3_rx_prodring_free(tp, &tp->prodring[j]); + if (!tnapi->tx_buffers) continue; @@ -6264,8 +6266,6 @@ static void tg3_free_rings(struct tg3 *tp) dev_kfree_skb_any(skb); } - - tg3_rx_prodring_free(tp, &tp->prodring[j]); } } -- 2.41.0