iommu/amd: Check PM_LEVEL_SIZE() condition in locked section
authorJoerg Roedel <jroedel@suse.de>
Fri, 18 Oct 2019 09:34:22 +0000 (11:34 +0200)
committerJoerg Roedel <jroedel@suse.de>
Fri, 18 Oct 2019 14:52:37 +0000 (16:52 +0200)
commit46ac18c347b00be29b265c28209b0f3c38a1f142
treeec59ad83cad68ff3994928323dc38762397db82c
parentec21f17a9437e11bb29e5fa375aa31b472793c15
iommu/amd: Check PM_LEVEL_SIZE() condition in locked section

The increase_address_space() function has to check the PM_LEVEL_SIZE()
condition again under the domain->lock to avoid a false trigger of the
WARN_ON_ONCE() and to avoid that the address space is increase more
often than necessary.

Reported-by: Qian Cai <cai@lca.pw>
Fixes: 754265bcab78 ("iommu/amd: Fix race in increase_address_space()")
Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/amd_iommu.c