Skip to content

Commit c60d847

Browse files
willdeaconMarc Zyngier
authored and
Marc Zyngier
committed
KVM: arm64: Fix double-free following kvm_pgtable_stage2_free_unlinked()
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 <[email protected]> Fixes: f6a27d6 ("KVM: arm64: Drop last page ref in kvm_pgtable_stage2_free_removed()") Signed-off-by: Will Deacon <[email protected]> Reviewed-by: Oliver Upton <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 42dfa94 commit c60d847

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

arch/arm64/kvm/hyp/pgtable.c

-2
Original file line numberDiff line numberDiff line change
@@ -1419,7 +1419,6 @@ kvm_pte_t *kvm_pgtable_stage2_create_unlinked(struct kvm_pgtable *pgt,
14191419
level + 1);
14201420
if (ret) {
14211421
kvm_pgtable_stage2_free_unlinked(mm_ops, pgtable, level);
1422-
mm_ops->put_page(pgtable);
14231422
return ERR_PTR(ret);
14241423
}
14251424

@@ -1502,7 +1501,6 @@ static int stage2_split_walker(const struct kvm_pgtable_visit_ctx *ctx,
15021501

15031502
if (!stage2_try_break_pte(ctx, mmu)) {
15041503
kvm_pgtable_stage2_free_unlinked(mm_ops, childp, level);
1505-
mm_ops->put_page(childp);
15061504
return -EAGAIN;
15071505
}
15081506

0 commit comments

Comments
 (0)