Patchwork [2/2] KVM: PPC: e500: MMU API: fix leak of shared_tlb_pages

login
register
mail settings
Submitter Scott Wood
Date Aug. 23, 2012, 1:04 a.m.
Message ID <1345683864-10815-2-git-send-email-scottwood@freescale.com>
Download mbox | patch
Permalink /patch/179479/
State New
Headers show

Comments

Scott Wood - Aug. 23, 2012, 1:04 a.m.
This was found by kmemleak.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/kvm/e500_tlb.c |    2 ++
 1 file changed, 2 insertions(+)
Alexander Graf - Sept. 25, 2012, 7:46 a.m.
On 23.08.2012, at 03:04, Scott Wood wrote:

> This was found by kmemleak.
> 
> Signed-off-by: Scott Wood <scottwood@freescale.com>

Thanks, applied to kvm-ppc-next.


Alex

> ---
> arch/powerpc/kvm/e500_tlb.c |    2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/arch/powerpc/kvm/e500_tlb.c b/arch/powerpc/kvm/e500_tlb.c
> index a27d134..641f978 100644
> --- a/arch/powerpc/kvm/e500_tlb.c
> +++ b/arch/powerpc/kvm/e500_tlb.c
> @@ -1134,6 +1134,8 @@ static void free_gtlb(struct kvmppc_vcpu_e500 *vcpu_e500)
> 		}
> 
> 		vcpu_e500->num_shared_tlb_pages = 0;
> +
> +		kfree(vcpu_e500->shared_tlb_pages);
> 		vcpu_e500->shared_tlb_pages = NULL;
> 	} else {
> 		kfree(vcpu_e500->gtlb_arch);
> -- 
> 1.7.9.5
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/arch/powerpc/kvm/e500_tlb.c b/arch/powerpc/kvm/e500_tlb.c
index a27d134..641f978 100644
--- a/arch/powerpc/kvm/e500_tlb.c
+++ b/arch/powerpc/kvm/e500_tlb.c
@@ -1134,6 +1134,8 @@  static void free_gtlb(struct kvmppc_vcpu_e500 *vcpu_e500)
 		}
 
 		vcpu_e500->num_shared_tlb_pages = 0;
+
+		kfree(vcpu_e500->shared_tlb_pages);
 		vcpu_e500->shared_tlb_pages = NULL;
 	} else {
 		kfree(vcpu_e500->gtlb_arch);