Skip to content

Commit

Permalink
msix: Prevent bogus mask updates on MMIO accesses
Browse files Browse the repository at this point in the history
>From: Jan Kiszka <[email protected]>

Only accesses to the MSI-X table must trigger a call to
msix_handle_mask_update, otherwise the vector
value might be out of range.

Signed-off-by: Jan Kiszka <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
  • Loading branch information
mstsirkin authored and Anthony Liguori committed Nov 21, 2011
1 parent 5032224 commit 9a93b61
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hw/msix.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@ static void msix_mmio_write(void *opaque, target_phys_addr_t addr,
PCIDevice *dev = opaque;
unsigned int offset = addr & (MSIX_PAGE_SIZE - 1) & ~0x3;
int vector = offset / PCI_MSIX_ENTRY_SIZE;

/* MSI-X page includes a read-only PBA and a writeable Vector Control. */
if (vector >= dev->msix_entries_nr) {
return;
}

pci_set_long(dev->msix_table_page + offset, val);
msix_handle_mask_update(dev, vector);
}
Expand Down

0 comments on commit 9a93b61

Please sign in to comment.