Linux-HyperV List
 help / color / mirror / Atom feed
* [PATCH 1/1] Drivers: hv: vmbus: Fail VMBus module init for non-nested root partition
@ 2026-08-04 19:05 Michael Kelley
  2026-08-04 19:21 ` sashiko-bot
  2026-08-04 19:39 ` Easwar Hariharan
  0 siblings, 2 replies; 7+ messages in thread
From: Michael Kelley @ 2026-08-04 19:05 UTC (permalink / raw)
  To: kys, haiyangz, wei.liu, decui, longli, linux-hyperv; +Cc: linux-kernel

The VMBus module should not be loaded when Linux is running directly
in the root partition and root is not nested in another VM. Current
code checks this condition and skips VMBus module initialization, which
works. But it returns 0 as the result, so Linux thinks the module has
successfully loaded. Later, if the module were to be unloaded, the
VMBus module unload code tries to clean up things that were never
initialized, resulting in memory faults and a panic.

Fix this by having VMBus module initialization return -ENODEV for this
case. The module is then not loaded, and the unload path can never run.

Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/linux-hyperv/20260721154943.A09BD1F00A3D@smtp.kernel.org/
Fixes: 7e279d78664aa ("Drivers: hv: vmbus: skip VMBus initialization if Linux is root")
Signed-off-by: Michael Kelley <mhklinux@outlook.com>
---
 drivers/hv/vmbus_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index e19ec73b0187..849d7e1a7320 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -2976,7 +2976,7 @@ static int __init hv_acpi_init(void)
 		return -ENODEV;
 
 	if (hv_root_partition() && !hv_nested)
-		return 0;
+		return -ENODEV;
 
 	/*
 	 * Get ACPI resources first.
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-08-05  4:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-04 19:05 [PATCH 1/1] Drivers: hv: vmbus: Fail VMBus module init for non-nested root partition Michael Kelley
2026-08-04 19:21 ` sashiko-bot
2026-08-04 19:39 ` Easwar Hariharan
2026-08-04 22:17   ` Michael Kelley
2026-08-04 22:47     ` Easwar Hariharan
2026-08-04 22:48       ` Easwar Hariharan
2026-08-05  4:13         ` Michael Kelley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox