]> git.baikalelectronics.ru Git - kernel.git/commit
iommu/io-pgtable-arm: Fix IOVA validation for 32-bit
authorRobin Murphy <robin.murphy@arm.com>
Fri, 28 Feb 2020 14:18:55 +0000 (14:18 +0000)
committerJoerg Roedel <jroedel@suse.de>
Mon, 2 Mar 2020 16:17:26 +0000 (17:17 +0100)
commitfdc370384ed7e004d8d19e1e0b55e99fc2d71d8e
treed3f2b6b5c0d7a1cd36202037961608a9cb6069ec
parent2303129d129af6178cb02fd75270b7bf3bfbd45c
iommu/io-pgtable-arm: Fix IOVA validation for 32-bit

Since we ony support the TTB1 quirk for AArch64 contexts, and
consequently only for 64-bit builds, the sign-extension aspect of the
"are all bits above IAS consistent?" check should implicitly only apply
to 64-bit IOVAs. Change the type of the cast to ensure that 32-bit longs
don't inadvertently get sign-extended, and thus considered invalid, if
they happen to be above 2GB in the TTB0 region.

Reported-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Acked-by: Acked-by: Will Deacon <will@kernel.org>
Fixes: 6d39ebae297b ("iommu/io-pgtable-arm: Prepare for TTBR1 usage")
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/io-pgtable-arm.c