E1000 mbuf leaks

Yonghyeon PYUN pyunyh at gmail.com
Mon Jul 27 12:59:02 UTC 2015


On Mon, Jul 27, 2015 at 01:02:32PM +0200, Hans Petter Selasky wrote:
> 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.

I don't think it's an mbuf leak since lem(4) just prepend the mbuf
to the if sendq(driver will retry it later).  But I think your
patch looks more correct in bus_dma(9) perspective.  If
bus_dmamap_load_mbuf_sg(9) returned an error except EFBIG, it would
be correct for lem(4) to free the mbuf chains rather than
restarting the bus_dmamap_load_mbuf_sg(9) later which shall fail
again with ENOMEM.


More information about the freebsd-current mailing list