From: John Feeney <jfeeney@redhat.com> Date: Thu, 30 Sep 2010 21:10:52 -0400 Subject: [net] tg3: fix 5717/57765/5719 memory leak Message-id: <4CA4FCDC.7040608@redhat.com> Patchwork-id: 28528 O-Subject: [RHEL5.6 PATCH] tg3: Fix 5717/57765/5719 memory leak Bugzilla: 631963 RH-Acked-by: Stanislaw Gruszka <sgruszka@redhat.com> RH-Acked-by: David S. Miller <davem@redhat.com> bz631963 https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=631963 tg3: 5717 / 57765 / 5719 devices leak memory Description of problem: The rx producer ring does not get cleaned up properly. Solution: Move the call to tg3_rx_prodring_free so it is called for each vector. >From the commit: "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." Upstream commit: tg3: Fix a memory leak on 5717+ devices b28f6428af279ffb9e97ee00486a29498b7fcfdc Brew: Successfully built in Brew for all architectures (task_2785135). Testing: Sanity tested with Connectathon on a number of rhts/beaker systems with tg3 NICs. Note: We don't have any 5719, 5717, or 57765 NICs so I have asked Broadcom to test but so far have not heard back. Will report to list when they do. Acks would be appreciated. Thanks. Signed-off-by: Jarod Wilson <jarod@redhat.com> diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 66bf556..9a2e452 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -5758,6 +5758,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; @@ -5779,8 +5781,6 @@ static void tg3_free_rings(struct tg3 *tp) dev_kfree_skb_any(skb); } - - tg3_rx_prodring_free(tp, &tp->prodring[j]); } }