OSDN Git Service

vfio/spapr_tce: Get rid of possible infinite loop
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Tue, 2 Oct 2018 03:22:31 +0000 (13:22 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2019 08:20:43 +0000 (09:20 +0100)
commit42cdd8e9616d5a228ba1dd17ed8a2a8d2719b1a1
treedeabdecc3303d0aa70929ad1256640c74fb60cd2
parent3cb8eefbdc12d2f2d240b416cc014cc1a6fa8f05
vfio/spapr_tce: Get rid of possible infinite loop

[ Upstream commit 517ad4ae8aa93dccdb9a88c27257ecb421c9e848 ]

As a part of cleanup, the SPAPR TCE IOMMU subdriver releases preregistered
memory. If there is a bug in memory release, the loop in
tce_iommu_release() becomes infinite; this actually happened to me.

This makes the loop finite and prints a warning on every failure to make
the code more bug prone.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/vfio/vfio_iommu_spapr_tce.c