Commit 07b7d05377a5e2b242ef0cce3d461d3284700fc0
Committed by
Anthony Liguori
1 parent
9391e4b8
Fix do_pci_register_device() to reject devfn already in use
Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing
1 changed file
with
2 additions
and
0 deletions
hw/pci.c
| @@ -267,6 +267,8 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus, | @@ -267,6 +267,8 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus, | ||
| 267 | } | 267 | } |
| 268 | return NULL; | 268 | return NULL; |
| 269 | found: ; | 269 | found: ; |
| 270 | + } else if (bus->devices[devfn]) { | ||
| 271 | + return NULL; | ||
| 270 | } | 272 | } |
| 271 | pci_dev->bus = bus; | 273 | pci_dev->bus = bus; |
| 272 | pci_dev->devfn = devfn; | 274 | pci_dev->devfn = devfn; |