PCI: Hold pci_slot_mutex while searching bus->slots list
Previously, pci_setup_device() and similar functions searched the pci_bus->slots list without any locking. It was possible for another thread to update the list while we searched it. Add pci_dev_assign_slot() to search the list while holding pci_slot_mutex. [bhelgaas: changelog, fold in CONFIG_SYSFS fix] Tested-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Yijing Wang <wangyijing@huawei.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
committed by
Bjorn Helgaas
parent
6754676297
commit
017ffe64e8
@@ -798,6 +798,11 @@ struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
|
||||
const char *name,
|
||||
struct hotplug_slot *hotplug);
|
||||
void pci_destroy_slot(struct pci_slot *slot);
|
||||
#ifdef CONFIG_SYSFS
|
||||
void pci_dev_assign_slot(struct pci_dev *dev);
|
||||
#else
|
||||
static inline void pci_dev_assign_slot(struct pci_dev *dev) { }
|
||||
#endif
|
||||
int pci_scan_slot(struct pci_bus *bus, int devfn);
|
||||
struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn);
|
||||
void pci_device_add(struct pci_dev *dev, struct pci_bus *bus);
|
||||
|
||||
Reference in New Issue
Block a user