linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	Alex Williamson <alex.williamson@redhat.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.19 016/113] PCI: Return error if cannot probe VF
Date: Mon, 29 Jul 2019 21:21:43 +0200	[thread overview]
Message-ID: <20190729190659.676178730@linuxfoundation.org> (raw)
In-Reply-To: <20190729190655.455345569@linuxfoundation.org>

[ Upstream commit 76002d8b48c4b08c9bd414517dd295e132ad910b ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/pci/pci-driver.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 33f3f475e5c6..956ee7527d2c 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -414,6 +414,9 @@ static int pci_device_probe(struct device *dev)
 	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;
+
 	pci_assign_irq(pci_dev);
 
 	error = pcibios_alloc_irq(pci_dev);
@@ -421,12 +424,10 @@ static int pci_device_probe(struct device *dev)
 		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;
-- 
2.20.1




  parent reply	other threads:[~2019-07-29 20:07 UTC|newest]

Thread overview: 130+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-29 19:21 [PATCH 4.19 000/113] 4.19.63-stable review Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 001/113] hvsock: fix epollout hang from race condition Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 002/113] drm/panel: simple: Fix panel_simple_dsi_probe Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 003/113] iio: adc: stm32-dfsdm: manage the get_irq error case Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 004/113] iio: adc: stm32-dfsdm: missing error case during probe Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 005/113] staging: vt6656: use meaningful error code during buffer allocation Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 006/113] usb: core: hub: Disable hub-initiated U1/U2 Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 007/113] tty: max310x: Fix invalid baudrate divisors calculator Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 008/113] pinctrl: rockchip: fix leaked of_node references Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 009/113] tty: serial: cpm_uart - fix init when SMC is relocated Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 010/113] drm/amd/display: Fill prescale_params->scale for RGB565 Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 011/113] drm/amdgpu/sriov: Need to initialize the HDP_NONSURFACE_BAStE Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 012/113] drm/amd/display: Disable ABM before destroy ABM struct Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 013/113] drm/amdkfd: Fix a potential memory leak Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 014/113] drm/amdkfd: Fix sdma queue map issue Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 015/113] drm/edid: Fix a missing-check bug in drm_load_edid_firmware() Greg Kroah-Hartman
2019-07-29 19:21 ` Greg Kroah-Hartman [this message]
2019-07-29 19:21 ` [PATCH 4.19 017/113] drm/bridge: tc358767: read display_props in get_modes() Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 018/113] drm/bridge: sii902x: pixel clock unit is 10kHz instead of 1kHz Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 019/113] gpu: host1x: Increase maximum DMA segment size Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 020/113] drm/crc-debugfs: User irqsafe spinlock in drm_crtc_add_crc_entry Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 021/113] drm/crc-debugfs: Also sprinkle irqrestore over early exits Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 022/113] memstick: Fix error cleanup path of memstick_init Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 023/113] tty/serial: digicolor: Fix digicolor-usart already registered warning Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 024/113] tty: serial: msm_serial: avoid system lockup condition Greg Kroah-Hartman
2019-07-31 19:05   ` Pavel Machek
2019-07-31 20:34     ` Jorge Ramirez
2019-08-15  7:07       ` Pavel Machek
2019-07-29 19:21 ` [PATCH 4.19 025/113] serial: 8250: Fix TX interrupt handling condition Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 026/113] drm/amd/display: Always allocate initial connector state state Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 027/113] drm/virtio: Add memory barriers for capset cache Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 028/113] phy: renesas: rcar-gen2: Fix memory leak at error paths Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 029/113] drm/amd/display: fix compilation error Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 030/113] powerpc/pseries/mobility: prevent cpu hotplug during DT update Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 031/113] drm/rockchip: Properly adjust to a true clock in adjusted_mode Greg Kroah-Hartman
2019-07-29 19:21 ` [PATCH 4.19 032/113] serial: imx: fix locking in set_termios() Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 033/113] tty: serial_core: Set port active bit in uart_port_activate Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 034/113] usb: gadget: Zero ffs_io_data Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 035/113] mmc: sdhci: sdhci-pci-o2micro: Check if controller supports 8-bit width Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 036/113] powerpc/pci/of: Fix OF flags parsing for 64bit BARs Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 037/113] drm/msm: Depopulate platform on probe failure Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 038/113] serial: mctrl_gpio: Check if GPIO property exisits before requesting it Greg Kroah-Hartman
2019-07-31 18:19   ` Pavel Machek
2019-07-29 19:22 ` [PATCH 4.19 039/113] PCI: sysfs: Ignore lockdep for remove attribute Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 040/113] i2c: stm32f7: fix the get_irq error cases Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 041/113] kbuild: Add -Werror=unknown-warning-option to CLANG_FLAGS Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 042/113] genksyms: Teach parser about 128-bit built-in types Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 043/113] PCI: xilinx-nwl: Fix Multi MSI data programming Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 044/113] iio: iio-utils: Fix possible incorrect mask calculation Greg Kroah-Hartman
2019-07-30 18:51   ` Pavel Machek
2019-07-29 19:22 ` [PATCH 4.19 045/113] powerpc/cacheflush: fix variable set but not used Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 046/113] powerpc/xmon: Fix disabling tracing while in xmon Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 047/113] recordmcount: Fix spurious mcount entries on powerpc Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 048/113] mfd: madera: Add missing of table registration Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 049/113] mfd: core: Set fwnode for created devices Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 050/113] mfd: arizona: Fix undefined behavior Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 051/113] mfd: hi655x-pmic: Fix missing return value check for devm_regmap_init_mmio_clk Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 052/113] mm/swap: fix release_pages() when releasing devmap pages Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 053/113] um: Silence lockdep complaint about mmap_sem Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 054/113] powerpc/4xx/uic: clear pending interrupt after irq type/pol change Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 055/113] RDMA/i40iw: Set queue pair state when being queried Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 056/113] serial: sh-sci: Terminate TX DMA during buffer flushing Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 057/113] serial: sh-sci: Fix TX DMA buffer flushing and workqueue races Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 058/113] IB/mlx5: Fixed reporting counters on 2nd port for Dual port RoCE Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 059/113] powerpc/mm: Handle page table allocation failures Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 060/113] IB/ipoib: Add child to parent list only if device initialized Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 061/113] arm64: assembler: Switch ESB-instruction with a vanilla nop if !ARM64_HAS_RAS Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 062/113] PCI: mobiveil: Fix PCI base address in MEM/IO outbound windows Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 063/113] PCI: mobiveil: Fix the Class Code field Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 064/113] kallsyms: exclude kasan local symbols on s390 Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 065/113] PCI: mobiveil: Initialize Primary/Secondary/Subordinate bus numbers Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 066/113] PCI: mobiveil: Use the 1st inbound window for MEM inbound transactions Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 067/113] perf test mmap-thread-lookup: Initialize variable to suppress memory sanitizer warning Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 068/113] perf stat: Fix use-after-freed pointer detected by the smatch tool Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 069/113] perf top: Fix potential NULL pointer dereference " Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 070/113] perf session: Fix potential NULL pointer dereference found " Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 071/113] perf annotate: Fix dereferencing freed memory " Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 072/113] perf hists browser: Fix potential NULL pointer dereference " Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 073/113] RDMA/rxe: Fill in wc byte_len with IB_WC_RECV_RDMA_WITH_IMM Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 074/113] PCI: dwc: pci-dra7xx: Fix compilation when !CONFIG_GPIOLIB Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 075/113] powerpc/boot: add {get, put}_unaligned_be32 to xz_config.h Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 076/113] block: init flush rq ref count to 1 Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 077/113] f2fs: avoid out-of-range memory access Greg Kroah-Hartman
2019-07-31 19:11   ` Pavel Machek
2019-08-01  1:19     ` Chao Yu
2019-07-29 19:22 ` [PATCH 4.19 078/113] mailbox: handle failed named mailbox channel request Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 079/113] dlm: check if workqueues are NULL before flushing/destroying Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 080/113] powerpc/eeh: Handle hugepages in ioremap space Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 081/113] block/bio-integrity: fix a memory leak bug Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 082/113] sh: prevent warnings when using iounmap Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 083/113] mm/kmemleak.c: fix check for softirq context Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 084/113] 9p: pass the correct prototype to read_cache_page Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 085/113] mm/gup.c: mark undo_dev_pagemap as __maybe_unused Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 086/113] mm/gup.c: remove some BUG_ONs from get_gate_page() Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 087/113] memcg, fsnotify: no oom-kill for remote memcg charging Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 088/113] mm/mmu_notifier: use hlist_add_head_rcu() Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 089/113] proc: use down_read_killable mmap_sem for /proc/pid/smaps_rollup Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 090/113] proc: use down_read_killable mmap_sem for /proc/pid/pagemap Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 091/113] proc: use down_read_killable mmap_sem for /proc/pid/clear_refs Greg Kroah-Hartman
2019-07-29 19:22 ` [PATCH 4.19 092/113] proc: use down_read_killable mmap_sem for /proc/pid/map_files Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 093/113] cxgb4: reduce kernel stack usage in cudbg_collect_mem_region() Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 094/113] proc: use down_read_killable mmap_sem for /proc/pid/maps Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 095/113] locking/lockdep: Fix lock used or unused stats error Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 096/113] mm: use down_read_killable for locking mmap_sem in access_remote_vm Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 097/113] locking/lockdep: Hide unused class variable Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 098/113] usb: wusbcore: fix unbalanced get/put cluster_id Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 099/113] usb: pci-quirks: Correct AMD PLL quirk detection Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 100/113] btrfs: inode: Dont compress if NODATASUM or NODATACOW set Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 101/113] x86/sysfb_efi: Add quirks for some devices with swapped width and height Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 102/113] x86/speculation/mds: Apply more accurate check on hypervisor platform Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 103/113] binder: prevent transactions to context manager from its own process Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 104/113] fpga-manager: altera-ps-spi: Fix build error Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 105/113] mei: me: add mule creek canyon (EHL) device ids Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 106/113] hpet: Fix division by zero in hpet_time_div() Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 107/113] ALSA: ac97: Fix double free of ac97_codec_device Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 108/113] ALSA: line6: Fix wrong altsetting for LINE6_PODHD500_1 Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 109/113] ALSA: hda - Add a conexant codec entry to let mute led work Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 110/113] powerpc/xive: Fix loop exit-condition in xive_find_target_in_mask() Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 111/113] powerpc/tm: Fix oops on sigreturn on systems without TM Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 112/113] libnvdimm/bus: Stop holding nvdimm_bus_list_mutex over __nd_ioctl() Greg Kroah-Hartman
2019-07-31 18:14   ` Pavel Machek
2019-07-31 19:31     ` Dan Williams
2019-08-01  8:47       ` Greg Kroah-Hartman
2019-07-29 19:23 ` [PATCH 4.19 113/113] access: avoid the RCU grace period for the temporary subjective credentials Greg Kroah-Hartman
2019-07-30  2:34 ` [PATCH 4.19 000/113] 4.19.63-stable review kernelci.org bot
2019-07-30  9:11 ` Naresh Kamboju
2019-07-30 14:00 ` shuah
2019-07-30 18:42 ` Guenter Roeck
2019-07-31  5:30 ` Kelsey Skunberg
2019-07-31  9:35 ` Jon Hunter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190729190659.676178730@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=alex.williamson@redhat.com \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).