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)
committerHans van Kranenburg <hans@knorrie.org>
Fri, 4 Nov 2022 19:25:46 +0000 (19:25 +0000)
commit9cb92b608161286e841e72744721fc9a949eab1c
tree4db3c70f989449aea2de08163c5d38098039b5a8
parentb760ffbf6a0c3464873828708771633b40cf5993
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>
(cherry picked from commit 4d625ff3c3a939dc270b03654337568c30c5ab6e)

Gbp-Pq: Name 0031-xen-arm-acpi-The-fixmap-area-should-always-be-cleare.patch
xen/arch/arm/acpi/lib.c