Re: device driver memory leak in 5.1-20030726?

From: Gary Jennejohn <garyj_at_jennejohn.org>
Date: Tue, 29 Jul 2003 11:11:09 +0200
John-Mark Gurney writes:
> Gary Jennejohn wrote this message on Mon, Jul 28, 2003 at 12:58 +0200:
> > It appears to me that the test in usb_block_allocmem() should be
> > (p->tag->parent == tag || p->tag->parent == tag->parent) and NOT
> > p->tag == tag! That's because bus_dma_tag_create() uses the tag
> > passed into usb_block_allocmem() as newtag->parent!
> > 
> > Unfortunately, bus_dma_tag is an opaque type and there's no way to
> > access the parent member anywhere but in the MD busdma_machdep.c :-(
> > 
> > Anyway, as written there's no way that I can see that the code can
> > work correctly.
> 
> You miss the code in the XXX bit that overrides the tag with the tag
> passed in.  If we allocate a fullblock, the tag doesn't need to be
> overwriten since we end up freeing it, but in the fragment case, we
> override the tag, and we don't need to keep the tag allocated by
> usb_block_allocmem since we never end up freeing the block that is
> part of the fragments.
> 
> The bug fixed in rev1.2 was because of a difference in how NetBSD/OpenBSD
> handles things.  We wouldn't need this if we had a size parameter to
> bus_dmamem_alloc.
> 
> Please reread the code and see what I mean.
> 

OK. The questions still remains why it isn't working, or have you
figured that out? Obviously, I don't understand it ;-)

---
Gary Jennejohn / garyj[at]jennejohn.org gj[at]freebsd.org gj[at]denx.de
Received on Tue Jul 29 2003 - 00:11:33 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:16 UTC