git: 413197cef9cc - main - ppt: Fix panic when configuring unavailable MSI-X vector
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 16 May 2025 11:29:24 UTC
The branch main has been updated by kgalazka:
URL: https://cgit.FreeBSD.org/src/commit/?id=413197cef9ccbf22831eb914c2ef469880468d97
commit 413197cef9ccbf22831eb914c2ef469880468d97
Author: Krzysztof Galazka <kgalazka@FreeBSD.org>
AuthorDate: 2025-05-16 11:29:08 +0000
Commit: Krzysztof Galazka <kgalazka@FreeBSD.org>
CommitDate: 2025-05-16 11:29:08 +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 <kgalazka@FreeBSD.org>
Reviewed By: #bhyve, jhb
Approved by: erj (mentor), kbowling (mentor)
MFC after: 1 week
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D48812
---
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 c3b2b57da988..2cb459fb848f 100644
--- a/sys/amd64/vmm/io/ppt.c
+++ b/sys/amd64/vmm/io/ppt.c
@@ -750,6 +750,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);