All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: Alex Chiang <achiang@hp.com>,
	gregkh@suse.de, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: refcount leak in pci_get_device()?
Date: Thu, 21 Aug 2008 14:25:04 -0600	[thread overview]
Message-ID: <20080821202504.GU8318@parisc-linux.org> (raw)
In-Reply-To: <20080821201918.GA24411@ldl.fc.hp.com>

On Thu, Aug 21, 2008 at 02:19:18PM -0600, Alex Chiang wrote:
> #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
> 
> That eventually calls pci_get_dev_by_id(), which increases the
> refcount on the device, but never decrements it.
> 
> Looks like that change in behavior happened here:
> 
> 	PCI: clean up search.c a lot
> 	95247b57ed844511a212265b45cf9a919753aea1
> 
> pci_get_device() used to decrement the refcount, but no longer
> does.
> 
> Thanks to Matthew Wilcox for helping me get this far...
> 
> Like I said, I'm still trying to track down my particular issue,
> but I'd like to get your opinion on this.

In particular, I'd like to know whether this should be fixed by
pci_get_dev_by_id() decrementing the refcount of from/dev_start,
pci_get_subsys() decrementing 'from', or by bus_find_device()
decrementing 'start'.  It looks like bus_find_device() is the place
where this should logically happen, but the kerneldoc doesn't document
the intended behaviour.

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

  reply	other threads:[~2008-08-21 20:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-21 20:19 refcount leak in pci_get_device()? Alex Chiang
2008-08-21 20:25 ` Matthew Wilcox [this message]
2008-08-21 20:47   ` Greg KH
2008-08-21 22:14     ` Alex Chiang
2008-08-30  4:23       ` Zhao, Yu
2008-08-30  5:37         ` Greg KH
2008-08-30  6:20           ` Zhao, Yu
2008-08-31  3:14             ` problems in fakephp (was RE: refcount leak in pci_get_device()?) Zhao, Yu
2008-09-01 18:40               ` [PATCH] PCI Hotplug: fakephp: fix deadlock... again Alex Chiang
2008-09-02  0:10                 ` Matthew Wilcox
2008-09-02  0:19                   ` Alex Chiang
2008-09-09  4:12                     ` Jesse Barnes
2008-09-09  4:27                       ` Matthew Wilcox
2008-09-09  5:32                         ` Andrew Patterson
2008-09-04 15:03                 ` Zhao, Yu
2008-08-21 22:23     ` refcount leak in pci_get_device()? Jesse Barnes
2008-08-22  1:04       ` Henrique de Moraes Holschuh
2008-08-22  1:09         ` Henrique de Moraes Holschuh
2008-08-21 20:40 ` Greg KH

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=20080821202504.GU8318@parisc-linux.org \
    --to=matthew@wil.cx \
    --cc=achiang@hp.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.