linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: arm64: free kvm->arch.nested_mmus with kvfree()
@ 2024-07-23 14:20 Danilo Krummrich
  2024-07-23 15:00 ` Marc Zyngier
  2024-08-05 22:11 ` Oliver Upton
  0 siblings, 2 replies; 3+ messages in thread
From: Danilo Krummrich @ 2024-07-23 14:20 UTC (permalink / raw)
  To: maz, oliver.upton, james.morse, suzuki.poulose, yuzenghui,
	catalin.marinas, will, christoffer.dall
  Cc: linux-arm-kernel, kvmarm, linux-kernel, Danilo Krummrich

kvm->arch.nested_mmus is allocated with kvrealloc(), hence free it with
kvfree() instead of kfree().

Fixes: 4f128f8e1aaa ("KVM: arm64: nv: Support multiple nested Stage-2 mmu structures")
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
---
 arch/arm64/kvm/nested.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c
index de789e0f1ae9..bab27f9d8cc6 100644
--- a/arch/arm64/kvm/nested.c
+++ b/arch/arm64/kvm/nested.c
@@ -786,7 +786,7 @@ void kvm_arch_flush_shadow_all(struct kvm *kvm)
 		if (!WARN_ON(atomic_read(&mmu->refcnt)))
 			kvm_free_stage2_pgd(mmu);
 	}
-	kfree(kvm->arch.nested_mmus);
+	kvfree(kvm->arch.nested_mmus);
 	kvm->arch.nested_mmus = NULL;
 	kvm->arch.nested_mmus_size = 0;
 	kvm_uninit_stage2_mmu(kvm);

base-commit: 66ebbdfdeb093e097399b1883390079cd4c3022b
-- 
2.45.2



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

* Re: [PATCH] KVM: arm64: free kvm->arch.nested_mmus with kvfree()
  2024-07-23 14:20 [PATCH] KVM: arm64: free kvm->arch.nested_mmus with kvfree() Danilo Krummrich
@ 2024-07-23 15:00 ` Marc Zyngier
  2024-08-05 22:11 ` Oliver Upton
  1 sibling, 0 replies; 3+ messages in thread
From: Marc Zyngier @ 2024-07-23 15:00 UTC (permalink / raw)
  To: Danilo Krummrich
  Cc: oliver.upton, james.morse, suzuki.poulose, yuzenghui,
	catalin.marinas, will, christoffer.dall, linux-arm-kernel, kvmarm,
	linux-kernel

On Tue, 23 Jul 2024 15:20:52 +0100,
Danilo Krummrich <dakr@kernel.org> wrote:
> 
> kvm->arch.nested_mmus is allocated with kvrealloc(), hence free it with
> kvfree() instead of kfree().
> 
> Fixes: 4f128f8e1aaa ("KVM: arm64: nv: Support multiple nested Stage-2 mmu structures")
> Signed-off-by: Danilo Krummrich <dakr@kernel.org>
> ---
>  arch/arm64/kvm/nested.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c
> index de789e0f1ae9..bab27f9d8cc6 100644
> --- a/arch/arm64/kvm/nested.c
> +++ b/arch/arm64/kvm/nested.c
> @@ -786,7 +786,7 @@ void kvm_arch_flush_shadow_all(struct kvm *kvm)
>  		if (!WARN_ON(atomic_read(&mmu->refcnt)))
>  			kvm_free_stage2_pgd(mmu);
>  	}
> -	kfree(kvm->arch.nested_mmus);
> +	kvfree(kvm->arch.nested_mmus);
>  	kvm->arch.nested_mmus = NULL;
>  	kvm->arch.nested_mmus_size = 0;
>  	kvm_uninit_stage2_mmu(kvm);
> 

Ah, nice catch. Thanks for fixing it.

Reviewed-by: Marc Zyngier <maz@kernel.org>

	M.

-- 
Without deviation from the norm, progress is not possible.


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

* Re: [PATCH] KVM: arm64: free kvm->arch.nested_mmus with kvfree()
  2024-07-23 14:20 [PATCH] KVM: arm64: free kvm->arch.nested_mmus with kvfree() Danilo Krummrich
  2024-07-23 15:00 ` Marc Zyngier
@ 2024-08-05 22:11 ` Oliver Upton
  1 sibling, 0 replies; 3+ messages in thread
From: Oliver Upton @ 2024-08-05 22:11 UTC (permalink / raw)
  To: Danilo Krummrich, christoffer.dall, maz, suzuki.poulose,
	catalin.marinas, will, yuzenghui, james.morse
  Cc: Oliver Upton, linux-arm-kernel, kvmarm, linux-kernel

On Tue, 23 Jul 2024 16:20:52 +0200, Danilo Krummrich wrote:
> kvm->arch.nested_mmus is allocated with kvrealloc(), hence free it with
> kvfree() instead of kfree().
> 
> 

Vacation + catching a bug while I was out got me waaaaay behind. Sorry
I hadn't grabbed this yet.

Applied to kvmarm/fixes, thanks!

[1/1] KVM: arm64: free kvm->arch.nested_mmus with kvfree()
      https://git.kernel.org/kvmarm/kvmarm/c/32b9a52f88a5

--
Best,
Oliver


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

end of thread, other threads:[~2024-08-05 22:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-23 14:20 [PATCH] KVM: arm64: free kvm->arch.nested_mmus with kvfree() Danilo Krummrich
2024-07-23 15:00 ` Marc Zyngier
2024-08-05 22:11 ` Oliver Upton

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).