xen/iommu: x86: Don't try to free page tables is the IOMMU is not enabled
authorJulien Grall <jgrall@amazon.com>
Fri, 26 Feb 2021 10:56:38 +0000 (10:56 +0000)
committerJulien Grall <jgrall@amazon.com>
Tue, 2 Mar 2021 09:51:14 +0000 (09:51 +0000)
commitf4cf483e2a1aec2b359347f0a34abd6bf2f208c2
tree99db6177956ed578ac23657dd5e9a7ab1eb979f3
parent29fae90baa14f518407fe7c437d38af768a3134c
xen/iommu: x86: Don't try to free page tables is the IOMMU is not enabled

When using CONFIG_BIGMEM=y, the page_list cannot be accessed whilst it
is is unitialized. However, iommu_free_pgtables() will be called even if
the domain is not using an IOMMU.

Consequently, Xen will try to go through the page list and deference a
NULL pointer.

Bail out early if the domain is not using an IOMMU.

Fixes: 15bc9a1ef51c ("x86/iommu: add common page-table allocator")
Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-Acked-by: Ian Jackson <iwj@xenproject.org>
xen/drivers/passthrough/x86/iommu.c