xen/arm: acpi: The fixmap area should always be cleared during failure/unmap
authorJulien Grall <jgrall@amazon.com>
Sat, 26 Sep 2020 18:53:27 +0000 (19:53 +0100)
committerJulien Grall <jgrall@amazon.com>
Fri, 30 Oct 2020 18:43:23 +0000 (18:43 +0000)
commit4d625ff3c3a939dc270b03654337568c30c5ab6e
tree7bd098e43dbd60f0d9d0caf0e1c287c029fc38a3
parent1c4aa69ca1e1fad20b2158051eb152276d1eb973
xen/arm: acpi: The fixmap area should always be cleared during failure/unmap

Commit 022387ee1ad3 "xen/arm: mm: Don't open-code Xen PT update in
{set, clear}_fixmap()" enforced that each set_fixmap() should be
paired with a clear_fixmap(). Any failure to follow the model would
result to a platform crash.

Unfortunately, the use of fixmap in the ACPI code was overlooked as it
is calling set_fixmap() but not clear_fixmap().

The function __acpi_os_map_table() is reworked so:
    - We know before the mapping whether the fixmap region is big
    enough for the mapping.
    - It will fail if the fixmap is already in use. This is not a
    change of behavior but clarifying the current expectation to avoid
    hitting a BUG().

The function __acpi_os_unmap_table() will now call clear_fixmap().

Reported-by: Wei Xu <xuwei5@hisilicon.com>
Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/acpi/lib.c