Commit 57208632 authored by Michael Kelley's avatar Michael Kelley Committed by Greg Kroah-Hartman

Drivers: hv: vmbus: Cleanup synic memory free path

clk_evt memory is not being freed when the synic is shutdown
or when there is an allocation error.  Add the appropriate
kfree() call, along with a comment to clarify how the memory
gets freed after an allocation error.  Make the free path
consistent by removing checks for NULL since kfree() and
free_page() already do the check.
Signed-off-by: default avatarMichael Kelley <mikelley@microsoft.com>
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6ba34171
...@@ -242,6 +242,10 @@ int hv_synic_alloc(void) ...@@ -242,6 +242,10 @@ int hv_synic_alloc(void)
return 0; return 0;
err: err:
/*
* Any memory allocations that succeeded will be freed when
* the caller cleans up by calling hv_synic_free()
*/
return -ENOMEM; return -ENOMEM;
} }
...@@ -254,12 +258,10 @@ void hv_synic_free(void) ...@@ -254,12 +258,10 @@ void hv_synic_free(void)
struct hv_per_cpu_context *hv_cpu struct hv_per_cpu_context *hv_cpu
= per_cpu_ptr(hv_context.cpu_context, cpu); = per_cpu_ptr(hv_context.cpu_context, cpu);
if (hv_cpu->synic_event_page) kfree(hv_cpu->clk_evt);
free_page((unsigned long)hv_cpu->synic_event_page); free_page((unsigned long)hv_cpu->synic_event_page);
if (hv_cpu->synic_message_page) free_page((unsigned long)hv_cpu->synic_message_page);
free_page((unsigned long)hv_cpu->synic_message_page); free_page((unsigned long)hv_cpu->post_msg_page);
if (hv_cpu->post_msg_page)
free_page((unsigned long)hv_cpu->post_msg_page);
} }
kfree(hv_context.hv_numa_map); kfree(hv_context.hv_numa_map);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment