lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 27 Oct 2008 15:13:51 +0800
From:	"Zhao, Yu" <yu.zhao@...el.com>
To:	Matthew Wilcox <matthew@....cx>
CC:	Yu Zhao <yu.zhao@...scape.net>,
	Jesse Barnes <jbarnes@...tuousgeek.org>,
	"linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
	"greg@...ah.com" <greg@...ah.com>,
	"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"stable@...nel.org" <stable@...nel.org>,
	Rakib Mullick <rakib.mullick@...il.com>
Subject: Re: [PATCH] pci: Fixing drivers/pci/search.c compilation warning.

Matthew Wilcox wrote:
> On Mon, Oct 27, 2008 at 11:18:43AM +0800, Zhao, Yu wrote:
>> Matthew Wilcox wrote:
>>> Yes, that's why pci_find_device() is deprecated.  But it doesn't also
>>> need to be buggy ;-)
>> How about pci_get_bus_and_slot()? People would meet the problem with it 
>> anyway.
> 
> What problem with it?  It's documented to return the device with an
> increased refcount, and the implementation appears to do exactly that:
> 
> struct pci_dev * pci_get_bus_and_slot(unsigned int bus, unsigned int devfn)
> {
>         struct pci_dev *dev = NULL;
> 
>         while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
>                 if (pci_domain_nr(dev->bus) == 0 &&
>                    (dev->bus->number == bus && dev->devfn == devfn))
>                         return dev;
>         }
>         return NULL;
> }
> 
> Are you saying some users of it neglect to decrement the refcount before
> disposing of the device?
> 

The 'dev' returned by pci_get_device() may be destroyed by PCI hotplug. 
I suppose that passing this 'dev' to pci_get_device() in the next loop 
would crash the system, right?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists