Home Home > GIT Browse > SLE15
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-07-16 16:12:15 +0200
committerTakashi Iwai <tiwai@suse.de>2019-07-16 16:12:21 +0200
commit5e5091687a4011b7fa9c463c64b1c565156954a7 (patch)
tree4282c4393652ca663f1aa3404954cecc995dee94
parent0f2445e311653b861c9159a89d7cc01225268fb4 (diff)
PCI: Return error if cannot probe VF (bsc#1051510).
-rw-r--r--patches.drivers/PCI-Return-error-if-cannot-probe-VF.patch58
-rw-r--r--series.conf1
2 files changed, 59 insertions, 0 deletions
diff --git a/patches.drivers/PCI-Return-error-if-cannot-probe-VF.patch b/patches.drivers/PCI-Return-error-if-cannot-probe-VF.patch
new file mode 100644
index 0000000000..c625a7bfb2
--- /dev/null
+++ b/patches.drivers/PCI-Return-error-if-cannot-probe-VF.patch
@@ -0,0 +1,58 @@
+From 76002d8b48c4b08c9bd414517dd295e132ad910b Mon Sep 17 00:00:00 2001
+From: Alex Williamson <alex.williamson@redhat.com>
+Date: Wed, 1 May 2019 11:00:16 -0600
+Subject: [PATCH] PCI: Return error if cannot probe VF
+Git-commit: 76002d8b48c4b08c9bd414517dd295e132ad910b
+Patch-mainline: v5.3-rc1
+References: bsc#1051510
+
+Commit 0e7df22401a3 ("PCI: Add sysfs sriov_drivers_autoprobe to control
+VF driver binding") allows the user to specify that drivers for VFs of
+a PF should not be probed, but it actually causes pci_device_probe() to
+return success back to the driver core in this case. Therefore by all
+sysfs appearances the device is bound to a driver, the driver link from
+the device exists as does the device link back from the driver, yet the
+driver's probe function is never called on the device. We also fail to
+do any sort of cleanup when we're prohibited from probing the device,
+the IRQ setup remains in place and we even hold a device reference.
+
+Instead, abort with errno before any setup or references are taken when
+pci_device_can_probe() prevents us from trying to probe the device.
+
+Link: https://lore.kernel.org/lkml/155672991496.20698.4279330795743262888.stgit@gimli.home
+Fixes: 0e7df22401a3 ("PCI: Add sysfs sriov_drivers_autoprobe to control VF driver binding")
+Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+Acked-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ drivers/pci/pci-driver.c | 13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+--- a/drivers/pci/pci-driver.c
++++ b/drivers/pci/pci-driver.c
+@@ -412,17 +412,18 @@ static int pci_device_probe(struct devic
+ struct pci_dev *pci_dev = to_pci_dev(dev);
+ struct pci_driver *drv = to_pci_driver(dev->driver);
+
++ if (!pci_device_can_probe(pci_dev))
++ return -ENODEV;
++
+ error = pcibios_alloc_irq(pci_dev);
+ if (error < 0)
+ return error;
+
+ pci_dev_get(pci_dev);
+- if (pci_device_can_probe(pci_dev)) {
+- error = __pci_device_probe(drv, pci_dev);
+- if (error) {
+- pcibios_free_irq(pci_dev);
+- pci_dev_put(pci_dev);
+- }
++ error = __pci_device_probe(drv, pci_dev);
++ if (error) {
++ pcibios_free_irq(pci_dev);
++ pci_dev_put(pci_dev);
+ }
+
+ return error;
diff --git a/series.conf b/series.conf
index 49667091c0..5a43d25c56 100644
--- a/series.conf
+++ b/series.conf
@@ -22924,6 +22924,7 @@
patches.drm/drm-rockchip-Properly-adjust-to-a-true-clock-in-adju.patch
patches.drm/drm-msm-a3xx-remove-TPL1-regs-from-snapshot.patch
patches.drivers/mfd-intel-lpss-Release-IDA-resources.patch
+ patches.drivers/PCI-Return-error-if-cannot-probe-VF.patch
# powerpc/linux next
patches.arch/powerpc-pseries-dlpar-Fix-a-missing-check-in-dlpar_p.patch