Skip to content

Commit 2bb1499

Browse files
hoshinolinajannau
authored andcommitted
iommu/io-pgtable: dart: Fix freeing of non-leaf page tables
We increment the ptep to walk the page, so the subsequent free ended up freeing the *next* page which is not good. Signed-off-by: Asahi Lina <[email protected]>
1 parent db90a7e commit 2bb1499

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/iommu/io-pgtable-dart.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ apple_dart_alloc_pgtable(struct io_pgtable_cfg *cfg, void *cookie)
463463
static void apple_dart_free_pgtables(struct dart_io_pgtable *data, dart_iopte *ptep, int level)
464464
{
465465
dart_iopte *end;
466+
dart_iopte *start = ptep;
466467

467468
if (level > 1) {
468469
end = (void *)ptep + DART_GRANULE(data);
@@ -474,7 +475,7 @@ static void apple_dart_free_pgtables(struct dart_io_pgtable *data, dart_iopte *p
474475
apple_dart_free_pgtables(data, iopte_deref(pte, data), level - 1);
475476
}
476477
}
477-
free_pages((unsigned long)ptep, get_order(DART_GRANULE(data)));
478+
free_pages((unsigned long)start, get_order(DART_GRANULE(data)));
478479
}
479480

480481
static void apple_dart_free_pgtable(struct io_pgtable *iop)

0 commit comments

Comments
 (0)