Drivers: hv: vmbus: Fix the issue with freeing up hv_ctl_table_hdr
authorSunil Muthuswamy <sunilmut@microsoft.com>
Sat, 28 Jul 2018 21:58:46 +0000 (21:58 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 29 Jul 2018 06:09:56 +0000 (08:09 +0200)
The check to free the Hyper-V control table header was reversed. This
fixes it.

Fixes: 81b18bce48af ("Drivers: HV: Send one page worth of kmsg dump over Hyper-V during panic")
Signed-off-by: Sunil Muthuswamy <sunilmut@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hv/vmbus_drv.c

index a7f33c1f42c5a79a406a0af72b25c40f651d81a7..5e946b1be54c4d0312bb4048d575e81b396c1f7d 100644 (file)
@@ -1176,11 +1176,8 @@ err_alloc:
 
        bus_unregister(&hv_bus);
        free_page((unsigned long)hv_panic_page);
-       if (!hv_ctl_table_hdr) {
-               unregister_sysctl_table(hv_ctl_table_hdr);
-               hv_ctl_table_hdr = NULL;
-       }
-
+       unregister_sysctl_table(hv_ctl_table_hdr);
+       hv_ctl_table_hdr = NULL;
        return ret;
 }
 
@@ -1891,11 +1888,8 @@ static void __exit vmbus_exit(void)
        }
 
        free_page((unsigned long)hv_panic_page);
-       if (!hv_ctl_table_hdr) {
-               unregister_sysctl_table(hv_ctl_table_hdr);
-               hv_ctl_table_hdr = NULL;
-       }
-
+       unregister_sysctl_table(hv_ctl_table_hdr);
+       hv_ctl_table_hdr = NULL;
        bus_unregister(&hv_bus);
 
        cpuhp_remove_state(hyperv_cpuhp_online);