public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Russell King <rmk@arm.linux.org.uk>
To: Matthew Dobson <colpatch@us.ibm.com>
Cc: linux-kernel@vger.kernel.org, Greg KH <gregkh@us.ibm.com>
Subject: Re: [BUG/MEMLEAK?] struct pci_bus, child busses & bridges
Date: Thu, 25 Sep 2003 09:54:27 +0100	[thread overview]
Message-ID: <20030925095426.B30419@flint.arm.linux.org.uk> (raw)
In-Reply-To: <3F7237FB.8050509@us.ibm.com>; from colpatch@us.ibm.com on Wed, Sep 24, 2003 at 05:34:03PM -0700

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

  reply	other threads:[~2003-09-25  8:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-25  0:34 [BUG/MEMLEAK?] struct pci_bus, child busses & bridges Matthew Dobson
2003-09-25  8:54 ` Russell King [this message]
2003-09-25 18:14   ` Matthew Dobson
2003-09-25 18:53     ` Patrick Mochel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030925095426.B30419@flint.arm.linux.org.uk \
    --to=rmk@arm.linux.org.uk \
    --cc=colpatch@us.ibm.com \
    --cc=gregkh@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox