git: 439fa16e1fd3 - main - x86: do not leak msi_lock in msix_alloc() on iommu remapping failure

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sun, 27 Oct 2024 01:50:43 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=439fa16e1fd35181898b61264b205bf3b7103a41

commit 439fa16e1fd35181898b61264b205bf3b7103a41
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-10-27 01:39:58 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-10-27 01:50:15 +0000

    x86: do not leak msi_lock in msix_alloc() on iommu remapping failure
    
    Sponsored by:   Advanced Micro Devices (AMD)
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
---
 sys/x86/x86/msi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/x86/x86/msi.c b/sys/x86/x86/msi.c
index c8e7db9469ed..9d5a51f9753c 100644
--- a/sys/x86/x86/msi.c
+++ b/sys/x86/x86/msi.c
@@ -723,6 +723,7 @@ again:
 	if (error != 0) {
 		msi->msi_dev = NULL;
 		apic_free_vector(cpu, vector, i);
+		mtx_unlock(&msi_lock);
 		return (error);
 	}
 	msi->msi_remap_cookie = cookie;