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)
commit08090744f2dbba6b10d38fb17443c81f66798ca0
treed3f2b6b5c0d7a1cd36202037961608a9cb6069ec
parent77a1bce84bba01f3f143d77127b72e872b573795
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: db6903010aa5 ("iommu/io-pgtable-arm: Prepare for TTBR1 usage")
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/io-pgtable-arm.c