The branch stable/14 has been updated by kgalazka:

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

commit ae08f93663462b4b557806bda8c5446d39a0345f
Author:     Krzysztof Galazka <kgala...@freebsd.org>
AuthorDate: 2025-05-16 11:29:08 +0000
Commit:     Krzysztof Galazka <kgala...@freebsd.org>
CommitDate: 2025-06-03 16:41:17 +0000

    ppt: Fix panic when configuring unavailable MSI-X vector
    
    In some cases VM may have different idea about number
    of available MSI-X vectors then PPT driver. Return
    an error when VM requests setup for more vectors
    than expected.
    
    It was observed while using SR-IOV on an Intel E810 Ethernet adapter.
    VF driver in a VM sees a correct number of available MSI-X vectors,
    which depends on num-queues assigned in iovctl.conf, while
    pci_msix_count in the PPT driver always returns 1.
    
    Signed-off-by: Krzysztof Galazka <kgala...@freebsd.org>
    Reviewed By:    #bhyve, jhb
    Approved by:    erj (mentor), kbowling (mentor)
    Sponsored by:   Intel Corporation
    Differential Revision:  https://reviews.freebsd.org/D48812
    
    (cherry picked from commit 413197cef9ccbf22831eb914c2ef469880468d97)
---
 sys/amd64/vmm/io/ppt.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/amd64/vmm/io/ppt.c b/sys/amd64/vmm/io/ppt.c
index 7643ba0c2973..2db400cf0492 100644
--- a/sys/amd64/vmm/io/ppt.c
+++ b/sys/amd64/vmm/io/ppt.c
@@ -736,6 +736,9 @@ ppt_setup_msix(struct vm *vm, int bus, int slot, int func,
                }
        }
 
+       if (idx >= ppt->msix.num_msgs)
+               return (EINVAL);
+
        if ((vector_control & PCIM_MSIX_VCTRL_MASK) == 0) {
                /* Tear down the IRQ if it's already set up */
                ppt_teardown_msix_intr(ppt, idx);

Reply via email to