Messages in this thread |  | | | Date | Thu, 25 Sep 2003 09:54:27 +0100 | | From | Russell King <> | | Subject | Re: [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/
|  |