Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'pci-v4.18-fixes-5' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci

Pull PCI fixes from Bjorn Helgaas:

- Fix integer overflow in new mobiveil driver (Dan Carpenter)

- Fix race during NVMe removal/rescan (Hari Vyas)

* tag 'pci-v4.18-fixes-5' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
PCI: Fix is_added/is_busmaster race condition
PCI: mobiveil: Avoid integer overflow in IB_WIN_SIZE

+28 -13
+3 -1
arch/powerpc/kernel/pci-common.c
··· 42 42 #include <asm/ppc-pci.h> 43 43 #include <asm/eeh.h> 44 44 45 + #include "../../../drivers/pci/pci.h" 46 + 45 47 /* hose_spinlock protects accesses to the the phb_bitmap. */ 46 48 static DEFINE_SPINLOCK(hose_spinlock); 47 49 LIST_HEAD(hose_list); ··· 1016 1014 /* Cardbus can call us to add new devices to a bus, so ignore 1017 1015 * those who are already fully discovered 1018 1016 */ 1019 - if (dev->is_added) 1017 + if (pci_dev_is_added(dev)) 1020 1018 continue; 1021 1019 1022 1020 pcibios_setup_device(dev);
+2 -1
arch/powerpc/platforms/powernv/pci-ioda.c
··· 46 46 47 47 #include "powernv.h" 48 48 #include "pci.h" 49 + #include "../../../../drivers/pci/pci.h" 49 50 50 51 #define PNV_IODA1_M64_NUM 16 /* Number of M64 BARs */ 51 52 #define PNV_IODA1_M64_SEGS 8 /* Segments per M64 BAR */ ··· 3139 3138 struct pci_dn *pdn; 3140 3139 int mul, total_vfs; 3141 3140 3142 - if (!pdev->is_physfn || pdev->is_added) 3141 + if (!pdev->is_physfn || pci_dev_is_added(pdev)) 3143 3142 return; 3144 3143 3145 3144 pdn = pci_get_pdn(pdev);
+2 -1
arch/powerpc/platforms/pseries/setup.c
··· 71 71 #include <asm/security_features.h> 72 72 73 73 #include "pseries.h" 74 + #include "../../../../drivers/pci/pci.h" 74 75 75 76 int CMO_PrPSP = -1; 76 77 int CMO_SecPSP = -1; ··· 665 664 const int *indexes; 666 665 struct device_node *dn = pci_device_to_OF_node(pdev); 667 666 668 - if (!pdev->is_physfn || pdev->is_added) 667 + if (!pdev->is_physfn || pci_dev_is_added(pdev)) 669 668 return; 670 669 /*Firmware must support open sriov otherwise dont configure*/ 671 670 indexes = of_get_property(dn, "ibm,open-sriov-vf-bar-info", NULL);
+3 -3
drivers/pci/bus.c
··· 330 330 return; 331 331 } 332 332 333 - dev->is_added = 1; 333 + pci_dev_assign_added(dev, true); 334 334 } 335 335 EXPORT_SYMBOL_GPL(pci_bus_add_device); 336 336 ··· 347 347 348 348 list_for_each_entry(dev, &bus->devices, bus_list) { 349 349 /* Skip already-added devices */ 350 - if (dev->is_added) 350 + if (pci_dev_is_added(dev)) 351 351 continue; 352 352 pci_bus_add_device(dev); 353 353 } 354 354 355 355 list_for_each_entry(dev, &bus->devices, bus_list) { 356 356 /* Skip if device attach failed */ 357 - if (!dev->is_added) 357 + if (!pci_dev_is_added(dev)) 358 358 continue; 359 359 child = dev->subordinate; 360 360 if (child)
+1 -1
drivers/pci/controller/pcie-mobiveil.c
··· 107 107 #define CFG_WINDOW_TYPE 0 108 108 #define IO_WINDOW_TYPE 1 109 109 #define MEM_WINDOW_TYPE 2 110 - #define IB_WIN_SIZE (256 * 1024 * 1024 * 1024) 110 + #define IB_WIN_SIZE ((u64)256 * 1024 * 1024 * 1024) 111 111 #define MAX_PIO_WINDOWS 8 112 112 113 113 /* Parameters for the waiting for link up routine */
+1 -1
drivers/pci/hotplug/acpiphp_glue.c
··· 509 509 510 510 list_for_each_entry(dev, &bus->devices, bus_list) { 511 511 /* Assume that newly added devices are powered on already. */ 512 - if (!dev->is_added) 512 + if (!pci_dev_is_added(dev)) 513 513 dev->current_state = PCI_D0; 514 514 } 515 515
+11
drivers/pci/pci.h
··· 288 288 289 289 /* pci_dev priv_flags */ 290 290 #define PCI_DEV_DISCONNECTED 0 291 + #define PCI_DEV_ADDED 1 291 292 292 293 static inline int pci_dev_set_disconnected(struct pci_dev *dev, void *unused) 293 294 { ··· 299 298 static inline bool pci_dev_is_disconnected(const struct pci_dev *dev) 300 299 { 301 300 return test_bit(PCI_DEV_DISCONNECTED, &dev->priv_flags); 301 + } 302 + 303 + static inline void pci_dev_assign_added(struct pci_dev *dev, bool added) 304 + { 305 + assign_bit(PCI_DEV_ADDED, &dev->priv_flags, added); 306 + } 307 + 308 + static inline bool pci_dev_is_added(const struct pci_dev *dev) 309 + { 310 + return test_bit(PCI_DEV_ADDED, &dev->priv_flags); 302 311 } 303 312 304 313 #ifdef CONFIG_PCI_ATS
+2 -2
drivers/pci/probe.c
··· 2433 2433 dev = pci_scan_single_device(bus, devfn); 2434 2434 if (!dev) 2435 2435 return 0; 2436 - if (!dev->is_added) 2436 + if (!pci_dev_is_added(dev)) 2437 2437 nr++; 2438 2438 2439 2439 for (fn = next_fn(bus, dev, 0); fn > 0; fn = next_fn(bus, dev, fn)) { 2440 2440 dev = pci_scan_single_device(bus, devfn + fn); 2441 2441 if (dev) { 2442 - if (!dev->is_added) 2442 + if (!pci_dev_is_added(dev)) 2443 2443 nr++; 2444 2444 dev->multifunction = 1; 2445 2445 }
+3 -2
drivers/pci/remove.c
··· 19 19 { 20 20 pci_pme_active(dev, false); 21 21 22 - if (dev->is_added) { 22 + if (pci_dev_is_added(dev)) { 23 23 device_release_driver(&dev->dev); 24 24 pci_proc_detach_device(dev); 25 25 pci_remove_sysfs_dev_files(dev); 26 - dev->is_added = 0; 26 + 27 + pci_dev_assign_added(dev, false); 27 28 } 28 29 29 30 if (dev->bus->self)
-1
include/linux/pci.h
··· 368 368 unsigned int transparent:1; /* Subtractive decode bridge */ 369 369 unsigned int multifunction:1; /* Multi-function device */ 370 370 371 - unsigned int is_added:1; 372 371 unsigned int is_busmaster:1; /* Is busmaster */ 373 372 unsigned int no_msi:1; /* May not use MSI */ 374 373 unsigned int no_64bit_msi:1; /* May only use 32-bit MSIs */