HomeFreeBSD

iommu_gas: Avoid double unmapping on error

Description

iommu_gas: Avoid double unmapping on error

In the extremely unlikely case that the iommu_gas_map_region() call in
bus_dma_iommu_load_ident() failed, we would attempt to unmap the failed
entry twice, first in iommu_gas_map_region(), and a second time in the
caller. Once is enough, and twice is problematic because it leads to a
second RB_REMOVE call on the same tree node. Like it or not, RB_TREE
does not handle that possibility.

Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35869

(cherry picked from commit dfabdacb279ca603d008a0e7e952c5c59ac51da4)

Details

Provenance
alcAuthored on Jul 21 2022, 6:53 AM
dougmCommitted on Aug 8 2022, 3:16 AM
Reviewer
kib
Differential Revision
D35869: iommu_gas: Avoid double unmapping on error
Parents
rG02e43a0d0594: swap_pager: Reduce the scope of the object lock in putpages
Branches
Unknown
Tags
Unknown