milos-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
acpi RISC-V updates for v7.0-rc7 2026-04-05 14:43:47 -07:00
amba
android
ata ata: ahci: force 32-bit DMA for JMicron JMB582/JMB585 2026-04-07 09:36:46 +02:00
atm
auxdisplay
base kernfs: pass struct ns_common instead of const void * for namespace tags 2026-04-09 14:36:52 +02:00
bcma
block
bluetooth
bus
cache
cdrom
cdx
char
clk
clocksource
comedi comedi: dt2815: add hardware detection to prevent crash 2026-04-02 14:40:27 +02:00
connector
counter
cpufreq
cpuidle
crypto This push contains the following changes: 2026-04-02 17:29:48 -07:00
cxl
dax
dca
devfreq
dibs
dio
dma
dma-buf
dpll
edac EDAC/mc: Fix error path ordering in edac_mc_alloc() 2026-04-05 17:49:19 +02:00
eisa
extcon
firewire
firmware EFI fix for v7.0 #4 2026-04-09 11:21:21 -07:00
fpga
fsi
fwctl
gnss
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
hid hid-for-linus-2026040801 2026-04-08 13:38:30 -07:00
hsi
hte
hv Drivers: hv: vmbus: Export hv_vmbus_exists() and use it in pci-hyperv 2026-04-14 04:42:44 +00:00
hwmon
hwspinlock
hwtracing
i2c
i3c
idle
iio
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
iommu IOMMU Fix for Linux v7.0-rc7 2026-04-09 08:36:31 -07:00
ipack
irqchip
isdn
leds
macintosh
mailbox
mcb
md
media
memory
memstick
message
mfd
misc misc: fastrpc: check qcom_scm_assign_mem() return in rpmsg_probe 2026-04-02 14:42:19 +02:00
mmc
most
mtd
mux
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
nubus
nvdimm
nvme
nvmem nvmem: zynqmp_nvmem: Fix buffer size in DMA and memcpy 2026-04-02 16:44:40 +02:00
of
opp
parisc
parport
pci Drivers: hv: vmbus: Export hv_vmbus_exists() and use it in pci-hyperv 2026-04-14 04:42:44 +00:00
pcmcia
peci
perf
phy
pinctrl pinctrl: mcp23s08: Disable all pin interrupts during probe 2026-04-07 11:29:57 +02:00
platform
pmdomain
pnp
power
powercap
pps
ps3
ptp
pwm
rapidio
ras
regulator regulator: bd71828-regulator.c: Fix LDON-HEAD mode 2026-04-07 15:24:11 +01:00
remoteproc
resctrl
reset
rpmsg
rtc
s390 s390 updates for 7.0-rc7 2026-04-03 17:50:24 -07:00
sbus
scsi
sh
siox
slimbus
soc
soundwire
spi spi: zynq-qspi: Simplify clock handling with devm_clk_get_enabled() 2026-04-07 12:52:36 +01:00
spmi
ssb
staging
target
tc
tee
thermal thermal: core: Fix thermal zone device registration error path 2026-04-02 11:37:35 +02:00
thunderbolt
tty
ufs
uio
usb usb: typec: ucsi: skip connector validation before init 2026-04-07 13:35:44 +02:00
vdpa
vfio
vhost
video
virt
virtio
w1
watchdog
xen
zorro
Kconfig
Makefile