mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] KVM: arm64: Return on kvm_gmem_get_pfn() failure in gmem_abort()
@ 2026-10-22 12:30 Fuad Tabba
  2026-10-22 13:12 ` Suzuki K Poulose
  0 siblings, 1 reply; 2+ messages in thread
From: Fuad Tabba @ 2026-10-22 12:30 UTC (permalink / raw)
  To: Marc Zyngier, Oliver Upton
  Cc: kvmarm, linux-arm-kernel, linux-kernel, Joey Gouly,
	Suzuki K Poulose, Zenghui Yu, Steffen Eiden, Catalin Marinas,
	Will Deacon, Mark Rutland, Vincent Donnefort, Wei-Lin Chang,
	Fuad Tabba

The kvm-arm64/mmu-fixes-7.4 merge dropped the return from the
kvm_gmem_get_pfn() error path in gmem_abort(). Both parents of the
merge keep that return. On a failed kvm_gmem_get_pfn(), gmem_abort()
then carries on with a zero pfn, and on a nested stage-2 it uses the
mapping it has just freed.

Restore the return.

Fixes: 65f95b2874a15 ("Merge branch kvm-arm64/mmu-fixes-7.4 into kvmarm-master/next")
Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
---

Notes:
    I went through the rest of the merge's conflict resolution with
    git show --remerge-diff, and this is the only line it dropped.

 arch/arm64/kvm/mmu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
index a48f3f531e827..ba4fe58222ad5 100644
--- a/arch/arm64/kvm/mmu.c
+++ b/arch/arm64/kvm/mmu.c
@@ -1802,6 +1802,7 @@ static int gmem_abort(const struct kvm_s2_fault_desc *s2fd,
 						      s2vi.vma_pagesize, write_fault, exec_fault,
 						      false);
 		kfree(mapping);
+		return ret;
 	}
 
 	if (!(s2fd->memslot->flags & KVM_MEM_READONLY))
-- 
2.47.3


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

* Re: [PATCH] KVM: arm64: Return on kvm_gmem_get_pfn() failure in gmem_abort()
  2026-10-22 12:30 [PATCH] KVM: arm64: Return on kvm_gmem_get_pfn() failure in gmem_abort() Fuad Tabba
@ 2026-10-22 13:12 ` Suzuki K Poulose
  0 siblings, 0 replies; 2+ messages in thread
From: Suzuki K Poulose @ 2026-10-22 13:12 UTC (permalink / raw)
  To: Fuad Tabba, Marc Zyngier, Oliver Upton
  Cc: kvmarm, linux-arm-kernel, linux-kernel, Joey Gouly, Zenghui Yu,
	Steffen Eiden, Catalin Marinas, Will Deacon, Mark Rutland,
	Vincent Donnefort, Wei-Lin Chang, Fuad Tabba

On 22/10/2026 13:30, Fuad Tabba wrote:
> The kvm-arm64/mmu-fixes-7.4 merge dropped the return from the
> kvm_gmem_get_pfn() error path in gmem_abort(). Both parents of the
> merge keep that return. On a failed kvm_gmem_get_pfn(), gmem_abort()
> then carries on with a zero pfn, and on a nested stage-2 it uses the
> mapping it has just freed.
> 
> Restore the return.
> 
> Fixes: 65f95b2874a15 ("Merge branch kvm-arm64/mmu-fixes-7.4 into kvmarm-master/next")
> Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
> ---
> 
> Notes:
>      I went through the rest of the merge's conflict resolution with
>      git show --remerge-diff, and this is the only line it dropped.
> 
>   arch/arm64/kvm/mmu.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
> index a48f3f531e827..ba4fe58222ad5 100644
> --- a/arch/arm64/kvm/mmu.c
> +++ b/arch/arm64/kvm/mmu.c
> @@ -1802,6 +1802,7 @@ static int gmem_abort(const struct kvm_s2_fault_desc *s2fd,
>   						      s2vi.vma_pagesize, write_fault, exec_fault,
>   						      false);
>   		kfree(mapping);
> +		return ret;
>   	}
>   
>   	if (!(s2fd->memslot->flags & KVM_MEM_READONLY))

Thanks for fixing this ! Looks correct to me.

Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>


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

end of thread, other threads:[~2026-10-22 13:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-22 12:30 [PATCH] KVM: arm64: Return on kvm_gmem_get_pfn() failure in gmem_abort() Fuad Tabba
2026-10-22 13:12 ` Suzuki K Poulose

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®