git: 0ba1d8608234 - main - iommu_gas: Add a missing error-case unlock

From: Alan Cox <alc_at_FreeBSD.org>
Date: Tue, 21 Jun 2022 05:00:18 UTC
The branch main has been updated by alc:

URL: https://cgit.FreeBSD.org/src/commit/?id=0ba1d8608234eee767b475627da6e5903ce7536a

commit 0ba1d8608234eee767b475627da6e5903ce7536a
Author:     Alan Cox <alc@FreeBSD.org>
AuthorDate: 2022-06-21 04:48:31 +0000
Commit:     Alan Cox <alc@FreeBSD.org>
CommitDate: 2022-06-21 04:48:31 +0000

    iommu_gas: Add a missing error-case unlock
    
    Release the domain lock when iommu_gas_reserve_region_extend()'s call to
    iommu_gas_reserve_region_locked() fails.
    
    MFC after:      2 weeks
---
 sys/dev/iommu/iommu_gas.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/dev/iommu/iommu_gas.c b/sys/dev/iommu/iommu_gas.c
index 70eef9a0a1f7..a9c4caa30dd8 100644
--- a/sys/dev/iommu/iommu_gas.c
+++ b/sys/dev/iommu/iommu_gas.c
@@ -781,8 +781,10 @@ iommu_gas_reserve_region_extend(struct iommu_domain *domain,
 		if (entry_start != entry_end) {
 			error = iommu_gas_reserve_region_locked(domain,
 			    entry_start, entry_end, entry);
-			if (error != 0)
+			if (error != 0) {
+				IOMMU_DOMAIN_UNLOCK(domain);
 				break;
+			}
 			entry = NULL;
 		}
 		IOMMU_DOMAIN_UNLOCK(domain);