iommu/vt-d: Check if domain->pgd was allocated
authorDmitry Safonov <dima@arista.com>
Tue, 16 Jul 2019 21:38:06 +0000 (22:38 +0100)
committerJoerg Roedel <jroedel@suse.de>
Mon, 22 Jul 2019 15:43:06 +0000 (17:43 +0200)
commit3ee9eca760e7d0b68c55813243de66bbb499dc3b
treec9017fd789a53e515aac8a47e3849f0df6967fb9
parenteffa467870c7612012885df4e246bdb8ffd8e44c
iommu/vt-d: Check if domain->pgd was allocated

There is a couple of places where on domain_init() failure domain_exit()
is called. While currently domain_init() can fail only if
alloc_pgtable_page() has failed.

Make domain_exit() check if domain->pgd present, before calling
domain_unmap(), as it theoretically should crash on clearing pte entries
in dma_pte_clear_level().

Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Lu Baolu <baolu.lu@linux.intel.com>
Cc: iommu@lists.linux-foundation.org
Signed-off-by: Dmitry Safonov <dima@arista.com>
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/intel-iommu.c