mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-28 08:02:54 +00:00
ixv: Check cap return before MSI-X enable write
In the QEMU workaround code in if_ixv.c, the ixv driver calls pci_find_cap(dev, PCIY_MSIX, &rid). It is not checking the return code from that function and the function appears to always be failing. This then causes the driver to use the rid variable uninitialized, which will mean setting a bit at an arbitrary offset in pci config space. For now, this seems to have no adverse impact, but it could easily cause very subtle problems. PR: 207037 MFC after: 3 days Sponsored by: BBOX.io
This commit is contained in:
parent
439fa16e1f
commit
b87b3696c9
@ -1073,11 +1073,14 @@ ixv_if_msix_intr_assign(if_ctx_t ctx, int msix)
|
||||
*/
|
||||
if (sc->hw.mac.type == ixgbe_mac_82599_vf) {
|
||||
int msix_ctrl;
|
||||
pci_find_cap(dev, PCIY_MSIX, &rid);
|
||||
rid += PCIR_MSIX_CTRL;
|
||||
msix_ctrl = pci_read_config(dev, rid, 2);
|
||||
msix_ctrl |= PCIM_MSIXCTRL_MSIX_ENABLE;
|
||||
pci_write_config(dev, rid, msix_ctrl, 2);
|
||||
if (pci_find_cap(dev, PCIY_MSIX, &rid)) {
|
||||
device_printf(dev, "Finding MSIX capability failed\n");
|
||||
} else {
|
||||
rid += PCIR_MSIX_CTRL;
|
||||
msix_ctrl = pci_read_config(dev, rid, 2);
|
||||
msix_ctrl |= PCIM_MSIXCTRL_MSIX_ENABLE;
|
||||
pci_write_config(dev, rid, msix_ctrl, 2);
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
Loading…
Reference in New Issue
Block a user