Skip to contentSkip to conversation

kernel-boot: Fix VF lookup

PATCH New Alaa Hleihel 1 participant 1 message Feb 21, 2021 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel-boot: Fix VF lookup

In function get_virtfn_info() we only compared the PCI function number. That is not enough as we can match with wrong device. This issue can be seen on systems with a large numbers of VFs.

Fix it by also comparing the PCI slot numbers.

Fixes 72f852c72a78 ("kernel-boot: Separate PCI fill function")

---
Pull request at github: https://github.com/linux-rdma/rdma-core/pull/950

---
 kernel-boot/rdma_rename.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel-boot/rdma_rename.c +2 -1
index e1ec8b198780..4af9e4a396f2 100644
@@ -338,7 +338,8 @@ static int get_virtfn_info(struct data *d, struct pci_info *p)
 			ret = -ENOMEM;
 			goto err_dir;
 		}
-		if (vf.func == v.func) {
+		if (vf.func == v.func &&
+		    vf.slot == v.slot) {
 			p->vf = atoi(&dent->d_name[6]);
 			break;
 		}
Signature · 1 line
2.26.2