summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2026-02-07 02:09:17 +0300
committerBjorn Helgaas <bhelgaas@google.com>2026-02-07 02:09:17 +0300
commit1cb15d2054064b554e31993fe72b9e93233cb10a (patch)
tree50b4899ef510ffb3c959ae9c2902a45b643c2de3
parenta89fdcb98ac82675879f43b9dfe69ba16be01255 (diff)
parenta5338e365c4559d7b4d7356116b0eb95b12e08d5 (diff)
downloadlinux-1cb15d2054064b554e31993fe72b9e93233cb10a.tar.xz
Merge branch 'pci/iov'
* pci/iov: PCI/IOV: Fix race between SR-IOV enable/disable and hotplug Revert "PCI/IOV: Add PCI rescan-remove locking when enabling/disabling SR-IOV"
-rw-r--r--drivers/pci/iov.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index 00784a60ba80..4a659c34935e 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -495,7 +495,9 @@ static ssize_t sriov_numvfs_store(struct device *dev,
if (num_vfs == 0) {
/* disable VFs */
+ pci_lock_rescan_remove();
ret = pdev->driver->sriov_configure(pdev, 0);
+ pci_unlock_rescan_remove();
goto exit;
}
@@ -507,7 +509,9 @@ static ssize_t sriov_numvfs_store(struct device *dev,
goto exit;
}
+ pci_lock_rescan_remove();
ret = pdev->driver->sriov_configure(pdev, num_vfs);
+ pci_unlock_rescan_remove();
if (ret < 0)
goto exit;
@@ -629,18 +633,15 @@ static int sriov_add_vfs(struct pci_dev *dev, u16 num_vfs)
if (dev->no_vf_scan)
return 0;
- pci_lock_rescan_remove();
for (i = 0; i < num_vfs; i++) {
rc = pci_iov_add_virtfn(dev, i);
if (rc)
goto failed;
}
- pci_unlock_rescan_remove();
return 0;
failed:
while (i--)
pci_iov_remove_virtfn(dev, i);
- pci_unlock_rescan_remove();
return rc;
}
@@ -765,10 +766,8 @@ static void sriov_del_vfs(struct pci_dev *dev)
struct pci_sriov *iov = dev->sriov;
int i;
- pci_lock_rescan_remove();
for (i = 0; i < iov->num_VFs; i++)
pci_iov_remove_virtfn(dev, i);
- pci_unlock_rescan_remove();
}
static void sriov_disable(struct pci_dev *dev)