Skip to content

Commit 7f11a2c

Browse files
Tianyu Lanliuw
authored andcommitted
x86/Hyper-V: Free hv_panic_page when fail to register kmsg dump
If kmsg_dump_register() fails, hv_panic_page will not be used anywhere. So free and reset it. Fixes: 81b18bc ("Drivers: HV: Send one page worth of kmsg dump over Hyper-V during panic") Reviewed-by: Michael Kelley <[email protected]> Signed-off-by: Tianyu Lan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Wei Liu <[email protected]>
1 parent 74347a9 commit 7f11a2c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/hv/vmbus_drv.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,9 +1385,13 @@ static int vmbus_bus_init(void)
13851385
hv_panic_page = (void *)hv_alloc_hyperv_zeroed_page();
13861386
if (hv_panic_page) {
13871387
ret = kmsg_dump_register(&hv_kmsg_dumper);
1388-
if (ret)
1388+
if (ret) {
13891389
pr_err("Hyper-V: kmsg dump register "
13901390
"error 0x%x\n", ret);
1391+
hv_free_hyperv_page(
1392+
(unsigned long)hv_panic_page);
1393+
hv_panic_page = NULL;
1394+
}
13911395
} else
13921396
pr_err("Hyper-V: panic message page memory "
13931397
"allocation failed");
@@ -1416,7 +1420,6 @@ static int vmbus_bus_init(void)
14161420
hv_remove_vmbus_irq();
14171421

14181422
bus_unregister(&hv_bus);
1419-
hv_free_hyperv_page((unsigned long)hv_panic_page);
14201423
unregister_sysctl_table(hv_ctl_table_hdr);
14211424
hv_ctl_table_hdr = NULL;
14221425
return ret;

0 commit comments

Comments
 (0)