mirror-linux/drivers
Dexuan Cui 0d5acba633 Drivers: hv: vmbus: Export hv_vmbus_exists() and use it in pci-hyperv
With commit f84b21da36 ("PCI: hv: Don't load the driver for baremetal root partition"),
the bare metal Linux root partition won't use the pci-hyperv driver, but
when a Linux VM runs on the Linux root partition, pci-hyperv's module_init
function init_hv_pci_drv() can still run, e.g. in the case of
CONFIG_PCI_HYPERV=y, even if the VMBus driver is not used in such a VM
(i.e. the hv_vmbus driver's init function returns -ENODEV due to
vmbus_root_device being NULL).

In such a Linux VM, init_hv_pci_drv() runs with a side effect: the 3
hvpci_block_ops callbacks are set to functions that depend on hv_vmbus.

Later, when the MLX driver in such a VM invokes the callbacks, e.g. in
drivers/net/ethernet/mellanox/mlx5/core/lib/hv.c:
mlx5_hv_register_invalidate(), hvpci_block_ops.reg_blk_invalidate() is
hv_register_block_invalidate() rather than a NULL function pointer, and
hv_register_block_invalidate() assumes that it can find a struct
hv_pcibus_device from pdev->bus->sysdata, which is false in such a VM.

Consequently, hv_register_block_invalidate() -> get_pcichild_wslot() ->
spin_lock_irqsave() may hang since it can be accessing an invalid
spinlock pointer.

Fix the issue by exporting hv_vmbus_exists() and using it in pci-hyperv:

    hv_root_partition() is true and hv_nested is false ==>
	hv_vmbus_exists() is false.

    hv_root_partition() is true and hv_nested is true ==>
	hv_vmbus_exists() is true.

    hv_root_partition() is false ==> hv_vmbus_exists() is true.

While at it, rename vmbus_exists() to hv_vmbus_exists() to follow the
convention that all public functions have the hv_ prefix; also change
the return value's type from int to bool to make the code more readable;
also move the two pr_info() calls.

Reported-by: Mukesh Rathor <mrathor@linux.microsoft.com>
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
2026-04-14 04:42:44 +00:00
..
accel accel: ethosu: Add hardware dependency hint 2026-04-02 15:18:14 -05:00
accessibility Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
acpi RISC-V updates for v7.0-rc7 2026-04-05 14:43:47 -07:00
amba Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
android rust_binder: use AssertSync for BINDER_VM_OPS 2026-03-31 14:58:56 +02:00
ata ata: ahci: force 32-bit DMA for JMicron JMB582/JMB585 2026-04-07 09:36:46 +02:00
atm Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
auxdisplay auxdisplay: line-display: fix NULL dereference in linedisp_release 2026-03-27 09:54:31 +01:00
base kernfs: pass struct ns_common instead of const void * for namespace tags 2026-04-09 14:36:52 +02:00
bcma Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
block zram: do not slot_free() written-back slots 2026-03-21 17:36:33 -07:00
bluetooth Bluetooth: hci_h4: Fix race during initialization 2026-04-01 16:45:47 -04:00
bus driver core: platform: use generic driver_override infrastructure 2026-03-17 20:30:57 +01:00
cache cache: ax45mp: Fix device node reference leak in ax45mp_cache_init() 2026-02-06 19:54:40 +00:00
cdrom Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
cdx Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
char Bug fixes for the IPMI driver 2026-02-26 14:34:21 -08:00
clk driver core: platform: use generic driver_override infrastructure 2026-03-17 20:30:57 +01:00
clocksource Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
comedi comedi: dt2815: add hardware detection to prevent crash 2026-04-02 14:40:27 +02:00
connector Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
counter counter: rz-mtu3-cnt: do not use struct rz_mtu3_channel's dev member 2026-03-22 15:59:22 +09:00
cpufreq cpufreq: governor: fix double free in cpufreq_dbs_governor_init() error path 2026-04-01 16:08:15 +02:00
cpuidle sched: idle: Make skipping governor callbacks more consistent 2026-03-10 16:03:02 +01:00
crypto This push contains the following changes: 2026-04-02 17:29:48 -07:00
cxl cxl: Adjust the startup priority of cxl_pmem to be higher than that of cxl_acpi 2026-03-19 15:12:40 -07:00
dax Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
dca treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
devfreq Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
dibs Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
dio Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
dma dmaengine: xilinx_dma: Fix reset related timeout with two-channel AXIDMA 2026-03-17 16:33:32 +05:30
dma-buf Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
dpll Including fixes from IPsec, Bluetooth and netfilter 2026-02-26 08:00:13 -08:00
edac EDAC/mc: Fix error path ordering in edac_mc_alloc() 2026-04-05 17:49:19 +02:00
eisa Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
extcon Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
firewire bonding: prevent potential infinite loop in bond_header_parse() 2026-03-16 19:29:45 -07:00
firmware EFI fix for v7.0 #4 2026-04-09 11:21:21 -07:00
fpga Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
fsi Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
fwctl Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
gnss Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
gpib gpib: fix use-after-free in IO ioctl handlers 2026-04-02 14:30:40 +02:00
gpio gpio: tegra: return -ENOMEM on allocation failure in probe 2026-04-10 09:01:24 +02:00
gpu Merge tag 'drm-intel-fixes-2026-04-09' of https://gitlab.freedesktop.org/drm/i915/kernel into drm-fixes 2026-04-11 07:35:22 +10:00
greybus Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
hid hid-for-linus-2026040801 2026-04-08 13:38:30 -07:00
hsi Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
hte Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
hv Drivers: hv: vmbus: Export hv_vmbus_exists() and use it in pci-hyperv 2026-04-14 04:42:44 +00:00
hwmon hwmon: (asus-ec-sensors) Fix T_Sensor for PRIME X670E-PRO WIFI 2026-04-01 07:45:57 -07:00
hwspinlock soc: driver updates for 7.0 2026-02-10 20:45:30 -08:00
hwtracing Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
i2c i2c: imx: zero-initialize dma_slave_config for eDMA 2026-04-02 01:22:46 +02:00
i3c i3c: dw-i3c-master: Set SIR_REJECT in DAT on device attach and reattach 2026-03-11 22:50:29 +01:00
idle
iio IIO: 3rd set of fixes for the 7.0 cycle. 2026-03-29 15:27:12 +02:00
infiniband kernfs: pass struct ns_common instead of const void * for namespace tags 2026-04-09 14:36:52 +02:00
input Input updates for v7.0-rc7 2026-04-11 11:12:38 -07:00
interconnect interconnect: qcom: sm8450: Fix NULL pointer dereference in icc_link_nodes() 2026-03-14 12:53:13 +02:00
iommu IOMMU Fix for Linux v7.0-rc7 2026-04-09 08:36:31 -07:00
ipack Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
irqchip irqchip/riscv-aplic: Restrict genpd notifier to device tree only 2026-03-31 10:11:29 +02:00
isdn Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
leds Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
macintosh Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
mailbox treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
mcb Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
md Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
media media: ccs: Avoid deadlock in ccs_init_state() 2026-03-26 13:14:07 +01:00
memory Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
memstick Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
message Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
mfd Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
misc misc: fastrpc: check qcom_scm_assign_mem() return in rpmsg_probe 2026-04-02 14:42:19 +02:00
mmc mmc: vub300: fix use-after-free on disconnect 2026-03-31 13:11:20 +02:00
most Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
mtd mtd: rawnand: pl353: make sure optimal timings are applied 2026-03-18 18:08:25 +01:00
mux Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
net vfs-7.0-rc8.fixes 2026-04-10 08:40:49 -07:00
nfc nfc: pn533: allocate rx skb before consuming bytes 2026-04-09 13:54:37 +02:00
ntb kmalloc_obj treewide refactoring for v7.0-rc1 2026-02-21 11:02:58 -08:00
nubus Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
nvdimm nvdimm/bus: Fix potential use after free in asynchronous initialization 2026-03-09 09:38:22 -05:00
nvme block-7.0-20260312 2026-03-13 10:13:06 -07:00
nvmem nvmem: zynqmp_nvmem: Fix buffer size in DMA and memcpy 2026-04-02 16:44:40 +02:00
of Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
opp Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
parisc Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
parport Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
pci Drivers: hv: vmbus: Export hv_vmbus_exists() and use it in pci-hyperv 2026-04-14 04:42:44 +00:00
pcmcia Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
peci Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
perf Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
phy phy: qcom: qmp-ufs: Fix SM8650 PCS table for Gear 4 2026-02-27 20:46:57 +05:30
pinctrl pinctrl: mcp23s08: Disable all pin interrupts during probe 2026-04-07 11:29:57 +02:00
platform platform/x86: asus-armoury: add support for GU605MU 2026-03-31 17:22:28 +03:00
pmdomain pmdomain: imx8mp-blk-ctrl: Keep the NOC_HDCP clock enabled 2026-04-01 13:03:07 +02:00
pnp Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
power power: sequencing: pcie-m2: Fix device node reference leak in probe 2026-03-04 09:16:41 +01:00
powercap Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
pps Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ps3 Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ptp Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
pwm Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
rapidio Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ras Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
regulator regulator: bd71828-regulator.c: Fix LDON-HEAD mode 2026-04-07 15:24:11 +01:00
remoteproc remoteproc: imx_rproc: Fix unreachable platform prepare_ops 2026-03-05 10:18:23 -07:00
resctrl arm_mpam: Force __iomem casts 2026-03-13 14:17:30 +00:00
reset reset: spacemit: k3: Decouple composite reset lines 2026-03-23 12:25:47 +01:00
rpmsg Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
rtc RTC for 7.0 2026-02-22 09:43:11 -08:00
s390 s390 updates for 7.0-rc7 2026-04-03 17:50:24 -07:00
sbus Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
scsi SCSI fixes on 20260327 2026-03-27 19:58:22 -07:00
sh Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
siox Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
slimbus driver core: platform: use generic driver_override infrastructure 2026-03-17 20:30:57 +01:00
soc Qualcomm driver fixes for v7.0 2026-04-01 13:47:03 +02:00
soundwire Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
spi spi: zynq-qspi: Simplify clock handling with devm_clk_get_enabled() 2026-04-07 12:52:36 +01:00
spmi Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ssb Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
staging staging: rtl8723bs: fix potential out-of-bounds read in rtw_restruct_wmm_ie 2026-02-24 10:01:20 -08:00
target scsi: target: file: Use kzalloc_flex for aio_cmd 2026-03-19 22:07:39 -04:00
tc Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
tee tee: shm: Remove refcounting of kernel pages 2026-03-03 09:03:04 +01:00
thermal thermal: core: Fix thermal zone device registration error path 2026-04-02 11:37:35 +02:00
thunderbolt thunderbolt: Fix property read in nhi_wake_supported() 2026-03-09 12:36:54 +01:00
tty vt: resize saved unicode buffer on alt screen exit after resize 2026-03-30 17:39:44 +02:00
ufs scsi: ufs: core: Fix SError in ufshcd_rtc_work() during UFS suspend 2026-03-07 11:08:39 -05:00
uio Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
usb usb: typec: ucsi: skip connector validation before init 2026-04-07 13:35:44 +02:00
vdpa Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
vfio vfio/pci: Fix double free in dma-buf feature 2026-03-26 06:38:27 -06:00
vhost Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
video fbdev: au1100fb: Fix build on MIPS64 2026-03-05 17:35:12 +01:00
virt virt: tdx-guest: Fix handling of host controlled 'quote' buffer length 2026-03-20 21:05:50 -07:00
virtio dma-mapping: Clarify valid conditions for CPU cache line overlap 2026-03-20 11:33:24 +01:00
w1 Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
watchdog Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
xen xen/privcmd: unregister xenstore notifier on module exit 2026-03-26 08:57:51 +01:00
zorro Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
Kconfig
Makefile phy: enter drivers/phy/Makefile even without CONFIG_GENERIC_PHY 2026-02-04 20:45:26 +05:30