> -----Original Message----- > From: Akihiko Odaki <akihiko.od...@daynix.com> > Sent: Wednesday, 28 February 2024 12:33 > To: Philippe Mathieu-Daudé <phi...@linaro.org>; Michael S. Tsirkin > <m...@redhat.com>; Marcel Apfelbaum <marcel.apfelb...@gmail.com>; > Alex Williamson <alex.william...@redhat.com>; Cédric Le Goater > <c...@redhat.com>; Paolo Bonzini <pbonz...@redhat.com>; Daniel P. > Berrangé <berra...@redhat.com>; Eduardo Habkost > <edua...@habkost.net>; Sriram Yagnaraman > <sriram.yagnara...@ericsson.com>; Jason Wang <jasow...@redhat.com>; > Keith Busch <kbu...@kernel.org>; Klaus Jensen <i...@irrelevant.dk>; Markus > Armbruster <arm...@redhat.com> > Cc: qemu-devel@nongnu.org; qemu-bl...@nongnu.org; Akihiko Odaki > <akihiko.od...@daynix.com>; qemu-sta...@nongnu.org > Subject: [PATCH v8 02/15] pcie_sriov: Validate NumVFs > > The guest may write NumVFs greater than TotalVFs and that can lead to buffer > overflow in VF implementations. > > Cc: qemu-sta...@nongnu.org > Fixes: CVE-2024-26327 > Fixes: 7c0fa8dff811 ("pcie: Add support for Single Root I/O Virtualization > (SR/IOV)") > Signed-off-by: Akihiko Odaki <akihiko.od...@daynix.com> > --- > hw/pci/pcie_sriov.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index > a1fe65f5d801..da209b7f47fd 100644 > --- a/hw/pci/pcie_sriov.c > +++ b/hw/pci/pcie_sriov.c > @@ -176,6 +176,9 @@ static void register_vfs(PCIDevice *dev) > > assert(sriov_cap > 0); > num_vfs = pci_get_word(dev->config + sriov_cap + PCI_SRIOV_NUM_VF); > + if (num_vfs > pci_get_word(dev->config + sriov_cap + > PCI_SRIOV_TOTAL_VF)) { > + return; > + } > > dev->exp.sriov_pf.vf = g_new(PCIDevice *, num_vfs); > > > -- > 2.43.2
Assuming change of my mail address from sriram.yagnara...@est.tech to @ericsson.com is accepted, Reviewed-by: Sriram Yagnaraman <sriram.yagnara...@ericsson.com>