• J
    iommu/amd: Fix race in increase_address_space() · f9186879
    Joerg Roedel 提交于
    [ Upstream commit 754265bcab78a9014f0f99cd35e0d610fcd7dfa7 ]
    
    After the conversion to lock-less dma-api call the
    increase_address_space() function can be called without any
    locking. Multiple CPUs could potentially race for increasing
    the address space, leading to invalid domain->mode settings
    and invalid page-tables. This has been happening in the wild
    under high IO load and memory pressure.
    
    Fix the race by locking this operation. The function is
    called infrequently so that this does not introduce
    a performance regression in the dma-api path again.
    Reported-by: NQian Cai <cai@lca.pw>
    Fixes: 256e4621 ('iommu/amd: Make use of the generic IOVA allocator')
    Signed-off-by: NJoerg Roedel <jroedel@suse.de>
    Signed-off-by: NSasha Levin <sashal@kernel.org>
    Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
    f9186879
amd_iommu.c 105.3 KB