lkml.org 
[lkml]   [2003]   [Sep]   [25]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateThu, 25 Sep 2003 09:54:27 +0100
FromRussell King <>
SubjectRe: [BUG/MEMLEAK?] struct pci_bus, child busses & bridges
On Wed, Sep 24, 2003 at 05:34:03PM -0700, Matthew Dobson wrote:
> In pci_alloc_child_bus (drivers/pci/probe.c), the child bus is allocated 
> and it's struct dev * is set to point to the struct dev belonging to the 
> bridge that this bus is 'on', or 'behind'.  pci_alloc_child_bus is 
> called in 3 places: pci_add_new_bus and twice in pci_scan_bridge.  The 
> calls in pci_scan_bridge allocate a new struct pci_bus, but then seem to 
> throw the references away, *without* freeing them.

That is correct - they persist after they have been allocated until the
bridge device is destroyed (if ever) - it's lifetime is directly equivalent
to the lifetime of the bridge.

If you look carefully at pci_alloc_child_bus(), you will notice that
bridge->subordinate is setup to point at the pci_bus, which provides
a method to access the data held in the pci_bus later (eg, while we're
freeing the structures.)

-- 
Russell King (rmk@arm.linux.org.uk)	http://www.arm.linux.org.uk/personal/
      Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
      maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                      2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:48    [from the cache]
©2003-2008