hw/nvme: Use pcie_sriov_num_vfs() (bsc#1220065, CVE-2024-26328) #64
Reference in New Issue
Block a user
Delete Branch "v8.2.2-factory"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
nvme_sriov_pre_write_ctrl() used to directly inspect SR-IOV configurations to know the number of VFs being disabled due to SR-IOV configuration writes, but the logic was flawed and resulted in out-of-bound memory access.
It assumed PCI_SRIOV_NUM_VF always has the number of currently enabled VFs, but it actually doesn't in the following cases:
It is a responsibility of pcie_sriov to interpret SR-IOV configurations and pcie_sriov does it correctly, so use pcie_sriov_num_vfs(), which it provides, to get the number of enabled VFs before and after SR-IOV configuration writes.
Cc: qemu-stable@nongnu.org
Fixes: CVE-2024-26328
Fixes:
11871f53ef("hw/nvme: Add support for the Virtualization Management command")Suggested-by: Michael S. Tsirkin mst@redhat.com
Message-Id: 20240228-reuse-v8-1-282660281e60@daynix.com
Reviewed-by: Michael S. Tsirkin mst@redhat.com
(cherry picked from commit
91bb64a8d2) References: bsc#1220065