kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: arm/arm64: Fix memory leak if timer initialization fails
@ 2015-10-06  8:14 Pavel Fedin
  2015-10-06 14:45 ` Wei Huang
  2015-10-08  8:56 ` Christoffer Dall
  0 siblings, 2 replies; 3+ messages in thread
From: Pavel Fedin @ 2015-10-06  8:14 UTC (permalink / raw)
  To: kvmarm, kvm; +Cc: marc.zyngier

Jump to correct label and free kvm_host_cpu_state

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
---
 arch/arm/kvm/arm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index dc017ad..78b2869 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -1080,7 +1080,7 @@ static int init_hyp_mode(void)
 	 */
 	err = kvm_timer_hyp_init();
 	if (err)
-		goto out_free_mappings;
+		goto out_free_context;
 
 #ifndef CONFIG_HOTPLUG_CPU
 	free_boot_hyp_pgd();
-- 
2.4.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: arm/arm64: Fix memory leak if timer initialization fails
  2015-10-06  8:14 [PATCH] KVM: arm/arm64: Fix memory leak if timer initialization fails Pavel Fedin
@ 2015-10-06 14:45 ` Wei Huang
  2015-10-08  8:56 ` Christoffer Dall
  1 sibling, 0 replies; 3+ messages in thread
From: Wei Huang @ 2015-10-06 14:45 UTC (permalink / raw)
  To: Pavel Fedin, kvmarm, kvm; +Cc: marc.zyngier



On 10/06/2015 03:14 AM, Pavel Fedin wrote:
> Jump to correct label and free kvm_host_cpu_state
> 
> Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
> ---
>  arch/arm/kvm/arm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
> index dc017ad..78b2869 100644
> --- a/arch/arm/kvm/arm.c
> +++ b/arch/arm/kvm/arm.c
> @@ -1080,7 +1080,7 @@ static int init_hyp_mode(void)
>  	 */
>  	err = kvm_timer_hyp_init();
>  	if (err)
> -		goto out_free_mappings;
> +		goto out_free_context;
>  
>  #ifndef CONFIG_HOTPLUG_CPU
>  	free_boot_hyp_pgd();
> 


kvm_host_cpu_state was allocated before kvm_timer_hyp_init() is called.
So it needs to be freed when kvm_timer_hyp_init() fails.

Reviewed-by: Wei Huang <wei@redhat.com>

Thanks,
-Wei

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: arm/arm64: Fix memory leak if timer initialization fails
  2015-10-06  8:14 [PATCH] KVM: arm/arm64: Fix memory leak if timer initialization fails Pavel Fedin
  2015-10-06 14:45 ` Wei Huang
@ 2015-10-08  8:56 ` Christoffer Dall
  1 sibling, 0 replies; 3+ messages in thread
From: Christoffer Dall @ 2015-10-08  8:56 UTC (permalink / raw)
  To: Pavel Fedin; +Cc: marc.zyngier, kvmarm, kvm

On Tue, Oct 06, 2015 at 11:14:35AM +0300, Pavel Fedin wrote:
> Jump to correct label and free kvm_host_cpu_state
> 
> Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
> ---
>  arch/arm/kvm/arm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
> index dc017ad..78b2869 100644
> --- a/arch/arm/kvm/arm.c
> +++ b/arch/arm/kvm/arm.c
> @@ -1080,7 +1080,7 @@ static int init_hyp_mode(void)
>  	 */
>  	err = kvm_timer_hyp_init();
>  	if (err)
> -		goto out_free_mappings;
> +		goto out_free_context;
>  
>  #ifndef CONFIG_HOTPLUG_CPU
>  	free_boot_hyp_pgd();

Nice catch.

Applied, thanks.

-Christoffer

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-08  8:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-06  8:14 [PATCH] KVM: arm/arm64: Fix memory leak if timer initialization fails Pavel Fedin
2015-10-06 14:45 ` Wei Huang
2015-10-08  8:56 ` Christoffer Dall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).