Skip to content

Commit 028700a

Browse files
committed
KVM: arm64: Fix double-free following kvm_pgtable_stage2_free_unlinked()
jira LE-1907 Rebuild_History Non-Buildable kernel-5.14.0-427.28.1.el9_4 commit-author Will Deacon <will@kernel.org> commit c60d847 kvm_pgtable_stage2_free_unlinked() does the final put_page() on the root page of the sub-tree before returning, so remove the additional put_page() invocations in the callers. Cc: Ricardo Koller <ricarkol@google.com> Fixes: f6a27d6 ("KVM: arm64: Drop last page ref in kvm_pgtable_stage2_free_removed()") Signed-off-by: Will Deacon <will@kernel.org> Reviewed-by: Oliver Upton <oliver.upton@linux.dev> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20240212193052.27765-1-will@kernel.org (cherry picked from commit c60d847) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 1978d5a commit 028700a

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

arch/arm64/kvm/hyp/pgtable.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,7 +1395,6 @@ kvm_pte_t *kvm_pgtable_stage2_create_unlinked(struct kvm_pgtable *pgt,
13951395
level + 1);
13961396
if (ret) {
13971397
kvm_pgtable_stage2_free_unlinked(mm_ops, pgtable, level);
1398-
mm_ops->put_page(pgtable);
13991398
return ERR_PTR(ret);
14001399
}
14011400

@@ -1478,7 +1477,6 @@ static int stage2_split_walker(const struct kvm_pgtable_visit_ctx *ctx,
14781477

14791478
if (!stage2_try_break_pte(ctx, mmu)) {
14801479
kvm_pgtable_stage2_free_unlinked(mm_ops, childp, level);
1481-
mm_ops->put_page(childp);
14821480
return -EAGAIN;
14831481
}
14841482

0 commit comments

Comments
 (0)