Date: Mon, 27 Jul 2015 13:02:32 +0200 From: Hans Petter Selasky <hps@selasky.org> To: FreeBSD Current <freebsd-current@freebsd.org>, Sean Bruno <sbruno@freebsd.org> Subject: E1000 mbuf leaks Message-ID: <55B60FC8.2020003@selasky.org>
next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------040406080501020804080904
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Hi,
I'm currently doing some busdma work, and possibly stepped over some
driver bugs. When "bus_dmamap_load_mbuf_sg()" returns ENOMEM the mbuf
chain is not freed. Is there some magic in "bus_dmamap_load_mbuf_sg()"
for that error code or is there a possible memory leak in all E1000
drivers? See attached patch.
> Index: if_em.c
> ===================================================================
> --- if_em.c (revision 284591)
> +++ if_em.c (working copy)
> @@ -2027,9 +2027,6 @@
> /* Try it again, but only once */
> remap = 0;
> goto retry;
> - } else if (error == ENOMEM) {
> - adapter->no_tx_dma_setup++;
> - return (error);
> } else if (error != 0) {
> adapter->no_tx_dma_setup++;
> m_freem(*m_headp);
> Index: if_igb.c
> ===================================================================
> --- if_igb.c (revision 284591)
> +++ if_igb.c (working copy)
> @@ -1905,9 +1905,6 @@
> goto retry;
> } else
> return (error);
> - case ENOMEM:
> - txr->no_tx_dma_setup++;
> - return (error);
> default:
> txr->no_tx_dma_setup++;
> m_freem(*m_headp);
> Index: if_lem.c
> ===================================================================
> --- if_lem.c (revision 284591)
> +++ if_lem.c (working copy)
> @@ -1693,6 +1693,8 @@
> }
> } else if (error != 0) {
> adapter->no_tx_dma_setup++;
> + m_freem(*m_headp);
> + *m_headp = NULL;
> return (error);
> }
>
--HPS
--------------040406080501020804080904
Content-Type: text/x-diff;
name="e1000-memory-leak.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="e1000-memory-leak.diff"
Index: if_em.c
===================================================================
--- if_em.c (revision 284591)
+++ if_em.c (working copy)
@@ -2027,9 +2027,6 @@
/* Try it again, but only once */
remap = 0;
goto retry;
- } else if (error == ENOMEM) {
- adapter->no_tx_dma_setup++;
- return (error);
} else if (error != 0) {
adapter->no_tx_dma_setup++;
m_freem(*m_headp);
Index: if_igb.c
===================================================================
--- if_igb.c (revision 284591)
+++ if_igb.c (working copy)
@@ -1905,9 +1905,6 @@
goto retry;
} else
return (error);
- case ENOMEM:
- txr->no_tx_dma_setup++;
- return (error);
default:
txr->no_tx_dma_setup++;
m_freem(*m_headp);
Index: if_lem.c
===================================================================
--- if_lem.c (revision 284591)
+++ if_lem.c (working copy)
@@ -1693,6 +1693,8 @@
}
} else if (error != 0) {
adapter->no_tx_dma_setup++;
+ m_freem(*m_headp);
+ *m_headp = NULL;
return (error);
}
--------------040406080501020804080904--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?55B60FC8.2020003>
