E1000 mbuf leaks
Hans Petter Selasky
hps at selasky.org
Mon Jul 27 11:01:09 UTC 2015
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: e1000-memory-leak.diff
Type: text/x-diff
Size: 1026 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-current/attachments/20150727/d493607b/attachment.bin>
More information about the freebsd-current
mailing list