diff options
author | Mostafa Saleh <smostafa@google.com> | 2024-10-24 16:25:15 +0000 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2024-10-29 15:27:57 +0000 |
commit | d71fa842d33c48ac2809ae11d2379b5a788792cb (patch) | |
tree | f77871faef25c4f55e70488ab7fb5805e681b0cf /tools/perf/scripts/python/export-to-sqlite.py | |
parent | 89edbe88db2857880b08ce363a2695eec657f51b (diff) |
iommu/io-pgtable-arm: Fix stage-2 map/unmap for concatenated tables
ARM_LPAE_LVL_IDX() takes into account concatenated PGDs and can return
an index spanning multiple page-table pages given a sufficiently large
input address. However, when the resulting index is used to calculate
the number of remaining entries in the page, the possibility of
concatenation is ignored and we end up computing a negative upper bound:
max_entries = ARM_LPAE_PTES_PER_TABLE(data) - map_idx_start;
On the map path, this results in a negative 'mapped' value being
returned but on the unmap path we can leak child tables if they are
skipped in __arm_lpae_free_pgtable().
Introduce an arm_lpae_max_entries() helper to convert a table index into
the remaining number of entries within a single page-table page.
Cc: <stable@vger.kernel.org>
Signed-off-by: Mostafa Saleh <smostafa@google.com>
Link: https://lore.kernel.org/r/20241024162516.2005652-2-smostafa@google.com
[will: Tweaked comment and commit message]
Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/export-to-sqlite.py')
0 files changed, 0 insertions, 0 deletions