E1000 mbuf leaks

From: Hans Petter Selasky <hps_at_selasky.org>
Date: Mon, 27 Jul 2015 13:02:32 +0200
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)
> _at__at_ -2027,9 +2027,6 _at__at_
>  		/* 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)
> _at__at_ -1905,9 +1905,6 _at__at_
>  				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)
> _at__at_ -1693,6 +1693,8 _at__at_
>  		}
>  	} else if (error != 0) {
>  		adapter->no_tx_dma_setup++;
> +		m_freem(*m_headp);
> +		*m_headp = NULL;
>  		return (error);
>  	}
>

--HPS

Received on Mon Jul 27 2015 - 09:01:09 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:58 UTC