aboutsummaryrefslogtreecommitdiff
path: root/drivers/pci/pci.h
diff options
context:
space:
mode:
authorGravatar Jakub Kicinski <jakub.kicinski@netronome.com> 2017-05-22 15:50:23 -0700
committerGravatar Bjorn Helgaas <bhelgaas@google.com> 2017-06-14 17:41:19 -0500
commit17530e71e0166a37f8e20a9b7bcf1d50ae3cff8e (patch)
tree985e0214ae3fae454db01acfdc1566d3c9d89798 /drivers/pci/pci.h
parentPCI: Mark Intel XXV710 NIC INTx masking as broken (diff)
downloadlinux-17530e71e0166a37f8e20a9b7bcf1d50ae3cff8e.tar.gz
linux-17530e71e0166a37f8e20a9b7bcf1d50ae3cff8e.tar.bz2
linux-17530e71e0166a37f8e20a9b7bcf1d50ae3cff8e.zip
PCI: Protect pci_driver->sriov_configure() usage with device_lock()
Every method in struct device_driver or structures derived from it like struct pci_driver MUST provide exclusion vs the driver's ->remove() method, usually by using device_lock(). Protect use of pci_driver->sriov_configure() by holding the device lock while calling it. The PCI core sets the pci_dev->driver pointer in local_pci_probe() before calling ->probe() and only clears it after ->remove(). This means driver's ->sriov_configure() callback will happily race with probe() and remove(), most likely leading to BUGs, since drivers don't expect this. Remove the iov lock completely, since we remove the last user. [bhelgaas: changelog, thanks to Christoph for locking rule] Link: http://lkml.kernel.org/r/20170522225023.14010-1-jakub.kicinski@netronome.com Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/pci/pci.h')
-rw-r--r--drivers/pci/pci.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index f8113e5b9812..93f4044b8f4b 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -272,7 +272,6 @@ struct pci_sriov {
u16 driver_max_VFs; /* max num VFs driver supports */
struct pci_dev *dev; /* lowest numbered PF */
struct pci_dev *self; /* this PF */
- struct mutex lock; /* lock for setting sriov_numvfs in sysfs */
resource_size_t barsz[PCI_SRIOV_NUM_BARS]; /* VF BAR size */
bool drivers_autoprobe; /* auto probing of VFs by driver */
};