Re: refcount leak in pci_get_device()?

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Alex Chiang <achiang@...>, <linux-pci@...>, <linux-kernel@...>
Date: Thursday, August 21, 2008 - 4:40 pm

On Thu, Aug 21, 2008 at 02:19:18PM -0600, Alex Chiang wrote:

No, pci_get_device() never decremented the refcount, and that didn't
change in the above git commit.

The description of pci_get_device() says that a reference is grabbed:
	Iterates through the list of known PCI devices.  If a PCI device
	is found with a matching @vendor and @device, the reference
	count to the device is incremented and a pointer to its device
	structure is returned.  Otherwise, %NULL is returned.  A new
	search is initiated by passing %NULL as the @from argument.
	Otherwise if @from is not %NULL, searches continue from next
	device on the global list.  The reference count for @from is
	always decremented if it is not %NULL.


All of the pci_find* functions should not have grabbed a reference to
the device, as that was the "old" behavior.  All of the pci_get*
functions do grab a reference.

Did I somehow mess up and one of the pci_find* functions now improperly
increment a reference?  Hopefully we shouldn't be using those functions
anymore as they aren't hotplug safe...

thanks,

greg k-h
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
refcount leak in pci_get_device()?, Alex Chiang, (Thu Aug 21, 4:19 pm)
Re: refcount leak in pci_get_device()?, Greg KH, (Thu Aug 21, 4:40 pm)
Re: refcount leak in pci_get_device()?, Matthew Wilcox, (Thu Aug 21, 4:25 pm)
Re: refcount leak in pci_get_device()?, Greg KH, (Thu Aug 21, 4:47 pm)
Re: refcount leak in pci_get_device()?, Jesse Barnes, (Thu Aug 21, 6:23 pm)
Re: refcount leak in pci_get_device()?, Henrique de Moraes Holschuh..., (Thu Aug 21, 9:04 pm)
Re: refcount leak in pci_get_device()?, Henrique de Moraes Holschuh..., (Thu Aug 21, 9:09 pm)
Re: refcount leak in pci_get_device()?, Alex Chiang, (Thu Aug 21, 6:14 pm)
RE: refcount leak in pci_get_device()?, Zhao, Yu, (Sat Aug 30, 12:23 am)
Re: refcount leak in pci_get_device()?, Greg KH, (Sat Aug 30, 1:37 am)
RE: refcount leak in pci_get_device()?, Zhao, Yu, (Sat Aug 30, 2:20 am)
[PATCH] PCI Hotplug: fakephp: fix deadlock... again, Alex Chiang, (Mon Sep 1, 2:40 pm)
Re: [PATCH] PCI Hotplug: fakephp: fix deadlock... again, Matthew Wilcox, (Mon Sep 1, 8:10 pm)
Re: [PATCH] PCI Hotplug: fakephp: fix deadlock... again, Jesse Barnes, (Tue Sep 9, 12:12 am)
Re: [PATCH] PCI Hotplug: fakephp: fix deadlock... again, Matthew Wilcox, (Tue Sep 9, 12:27 am)
Re: [PATCH] PCI Hotplug: fakephp: fix deadlock... again, Andrew Patterson, (Tue Sep 9, 1:32 am)