Skip to content

Commit fea93a3

Browse files
liuwkwilczynski
authored andcommitted
PCI: hv: Return zero, not garbage, when reading PCI_INTERRUPT_PIN
The intent of the code snippet is to always return 0 for both PCI_INTERRUPT_LINE and PCI_INTERRUPT_PIN. The check misses PCI_INTERRUPT_PIN. This patch fixes that. This is discovered by this call in VFIO: pci_read_config_byte(vdev->pdev, PCI_INTERRUPT_PIN, &pin); The old code does not set *val to 0 because it misses the check for PCI_INTERRUPT_PIN. Garbage is returned in that case. Fixes: 4daace0 ("PCI: hv: Add paravirtual PCI front-end for Microsoft Hyper-V VMs") Link: https://lore.kernel.org/linux-pci/[email protected] Signed-off-by: Wei Liu <[email protected]> Signed-off-by: Krzysztof Wilczyński <[email protected]> Reviewed-by: Michael Kelley <[email protected]> Cc: [email protected]
1 parent 1613e60 commit fea93a3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/pci/controller/pci-hyperv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,8 +1130,8 @@ static void _hv_pcifront_read_config(struct hv_pci_dev *hpdev, int where,
11301130
PCI_CAPABILITY_LIST) {
11311131
/* ROM BARs are unimplemented */
11321132
*val = 0;
1133-
} else if (where >= PCI_INTERRUPT_LINE && where + size <=
1134-
PCI_INTERRUPT_PIN) {
1133+
} else if ((where >= PCI_INTERRUPT_LINE && where + size <= PCI_INTERRUPT_PIN) ||
1134+
(where >= PCI_INTERRUPT_PIN && where + size <= PCI_MIN_GNT)) {
11351135
/*
11361136
* Interrupt Line and Interrupt PIN are hard-wired to zero
11371137
* because this front-end only supports message-signaled

0 commit comments

Comments
 (0)