]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Drivers: hv: vmbus: fix hyperv_cpuhp_online variable shadowing
authorJork Loeser <jloeser@linux.microsoft.com>
Wed, 8 Apr 2026 01:36:38 +0000 (18:36 -0700)
committerWei Liu <wei.liu@kernel.org>
Wed, 22 Apr 2026 06:23:25 +0000 (06:23 +0000)
vmbus_alloc_synic_and_connect() declares a local 'int
hyperv_cpuhp_online' that shadows the file-scope global of the same
name. The cpuhp state returned by cpuhp_setup_state() is stored in
the local, leaving the global at 0 (CPUHP_OFFLINE). When
hv_kexec_handler() or hv_machine_shutdown() later call
cpuhp_remove_state(hyperv_cpuhp_online) they pass 0, which hits the
BUG_ON in __cpuhp_remove_state_cpuslocked().

Remove the local declaration so the cpuhp state is stored in the
file-scope global where hv_kexec_handler() and hv_machine_shutdown()
expect it.

Fixes: 2647c96649ba ("Drivers: hv: Support establishing the confidential VMBus connection")
Signed-off-by: Jork Loeser <jloeser@linux.microsoft.com>
Reviewed-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
Reviewed-by: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
drivers/hv/vmbus_drv.c

index 24fa0b2443c3e6c3d02ddfe3800a0cb1c672698e..463eb818549e936197593ed0dcb92e18a4f43dd7 100644 (file)
@@ -1423,7 +1423,6 @@ static int vmbus_alloc_synic_and_connect(void)
 {
        int ret, cpu;
        struct work_struct __percpu *works;
-       int hyperv_cpuhp_online;
 
        ret = hv_synic_alloc();
        if (ret < 0)