linux-stable/drivers/hv
Maciej S. Szmigiero 9fc162c59e Drivers: hv: vmbus: Don't dereference ACPI root object handle
[ Upstream commit 78e04bbff8 ]

Since the commit referenced in the Fixes: tag below the VMBus client driver
is walking the ACPI namespace up from the VMBus ACPI device to the ACPI
namespace root object trying to find Hyper-V MMIO ranges.

However, if it is not able to find them it ends trying to walk resources of
the ACPI namespace root object itself.
This object has all-ones handle, which causes a NULL pointer dereference
in the ACPI code (from dereferencing this pointer with an offset).

This in turn causes an oops on boot with VMBus host implementations that do
not provide Hyper-V MMIO ranges in their VMBus ACPI device or its
ancestors.
The QEMU VMBus implementation is an example of such implementation.

I guess providing these ranges is optional, since all tested Windows
versions seem to be able to use VMBus devices without them.

Fix this by explicitly terminating the lookup at the ACPI namespace root
object.

Note that Linux guests under KVM/QEMU do not use the Hyper-V PV interface
by default - they only do so if the KVM PV interface is missing or
disabled.

Example stack trace of such oops:
[ 3.710827] ? __die+0x1f/0x60
[ 3.715030] ? page_fault_oops+0x159/0x460
[ 3.716008] ? exc_page_fault+0x73/0x170
[ 3.716959] ? asm_exc_page_fault+0x22/0x30
[ 3.717957] ? acpi_ns_lookup+0x7a/0x4b0
[ 3.718898] ? acpi_ns_internalize_name+0x79/0xc0
[ 3.720018] acpi_ns_get_node_unlocked+0xb5/0xe0
[ 3.721120] ? acpi_ns_check_object_type+0xfe/0x200
[ 3.722285] ? acpi_rs_convert_aml_to_resource+0x37/0x6e0
[ 3.723559] ? down_timeout+0x3a/0x60
[ 3.724455] ? acpi_ns_get_node+0x3a/0x60
[ 3.725412] acpi_ns_get_node+0x3a/0x60
[ 3.726335] acpi_ns_evaluate+0x1c3/0x2c0
[ 3.727295] acpi_ut_evaluate_object+0x64/0x1b0
[ 3.728400] acpi_rs_get_method_data+0x2b/0x70
[ 3.729476] ? vmbus_platform_driver_probe+0x1d0/0x1d0 [hv_vmbus]
[ 3.730940] ? vmbus_platform_driver_probe+0x1d0/0x1d0 [hv_vmbus]
[ 3.732411] acpi_walk_resources+0x78/0xd0
[ 3.733398] vmbus_platform_driver_probe+0x9f/0x1d0 [hv_vmbus]
[ 3.734802] platform_probe+0x3d/0x90
[ 3.735684] really_probe+0x19b/0x400
[ 3.736570] ? __device_attach_driver+0x100/0x100
[ 3.737697] __driver_probe_device+0x78/0x160
[ 3.738746] driver_probe_device+0x1f/0x90
[ 3.739743] __driver_attach+0xc2/0x1b0
[ 3.740671] bus_for_each_dev+0x70/0xc0
[ 3.741601] bus_add_driver+0x10e/0x210
[ 3.742527] driver_register+0x55/0xf0
[ 3.744412] ? 0xffffffffc039a000
[ 3.745207] hv_acpi_init+0x3c/0x1000 [hv_vmbus]

Fixes: 7f163a6fd9 ("drivers:hv: Modify hv_vmbus to search for all MMIO ranges available.")
Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Link: https://lore.kernel.org/r/fd8e64ceeecfd1d95ff49021080cf699e88dbbde.1691606267.git.maciej.szmigiero@oracle.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-09-13 09:48:36 +02:00
..
Kconfig Drivers: hv: Kconfig: Add HYPERV_VTL_MODE 2023-04-18 17:29:52 +00:00
Makefile Drivers: hv: Move Hyper-V extended capability check to arch neutral code 2021-06-05 10:22:34 +00:00
channel.c Drivers: hv: vmbus: Introduce {lock,unlock}_requestor() 2022-04-25 15:51:13 +00:00
channel_mgmt.c Drivers: hv: vmbus: Fix vmbus_wait_for_unload() to scan present CPUs 2023-05-23 18:53:16 +00:00
connection.c Drivers: hv: vmbus: Remove second mapping of VMBus monitor pages 2023-04-17 19:19:04 +00:00
hv.c Drivers: hv: move panic report code from vmbus to hv early init code 2023-04-20 23:00:37 +00:00
hv_balloon.c hyperv-next for v6.3. 2023-02-21 16:59:23 -08:00
hv_common.c x86/hyperv: Fix hyperv_pcpu_input_arg handling when CPUs go online/offline 2023-06-17 23:09:47 +00:00
hv_debugfs.c
hv_fcopy.c Drivers: hv: remove duplicate word in a comment 2022-09-05 16:28:40 +00:00
hv_kvp.c Drivers: hv: Fix syntax errors in comments 2022-06-08 12:26:28 +00:00
hv_snapshot.c hv_utils: Add comment about max VMbus packet size in VSS driver 2022-02-18 13:08:18 +00:00
hv_trace.c
hv_trace.h Drivers: hv: vmbus: Drivers: hv: vmbus: Introduce CHANNELMSG_MODIFYCHANNEL_RESPONSE 2021-04-18 13:03:11 +00:00
hv_trace_balloon.h
hv_util.c Drivers: hv: Make remove callback of hyperv driver void returned 2023-01-17 13:41:27 +00:00
hv_utils_transport.c Drivers: hv: utils: Make use of the helper macro LIST_HEAD() 2022-02-09 14:33:21 +00:00
hv_utils_transport.h
hyperv_vmbus.h Drivers: hv: vmbus: Remove the per-CPU post_msg_page 2023-04-17 19:19:05 +00:00
ring_buffer.c Drivers: hv: vmbus: Remove second way of mapping ring buffers 2023-04-17 19:19:04 +00:00
vmbus_drv.c Drivers: hv: vmbus: Don't dereference ACPI root object handle 2023-09-13 09:48:36 +02:00