When a domain parameter is provided to pci_get_pdev() the search
function would match against the bdf, without taking the segment into
account.

Fix this and also account for the passed segment.

Fixes: 8cf6e0738906 ('PCI: simplify (and thus correct) 
pci_get_pdev{,_by_domain}()')
Signed-off-by: Roger Pau Monné <roger....@citrix.com>
---
There's no mention in 8cf6e0738906 that avoiding the segment check is
fine, and hence I assume it's an oversight, as it should be possible
to have devices from multiple segments assigned to the same domain.
---
 xen/drivers/passthrough/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index b42acb8d7c09..07d1986d330a 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -552,7 +552,7 @@ struct pci_dev *pci_get_pdev(const struct domain *d, 
pci_sbdf_t sbdf)
     }
     else
         list_for_each_entry ( pdev, &d->pdev_list, domain_list )
-            if ( pdev->sbdf.bdf == sbdf.bdf )
+            if ( pdev->sbdf.sbdf == sbdf.sbdf )
                 return pdev;
 
     return NULL;
-- 
2.40.0


Reply via email to