Skip to content

Commit 3b9f942

Browse files
zijun-hubjorn-helgaas
authored andcommitted
PCI: endpoint: Finish virtual EP removal in pci_epf_remove_vepf()
When removing a virtual Endpoint, pci_epf_remove_vepf() failed to clear epf_vf->epf_pf, which caused a subsequent pci_epf_add_vepf() to incorrectly return -EBUSY: pci_epf_add_vepf(epf_pf, epf_vf) // add pci_epf_remove_vepf(epf_pf, epf_vf) // remove pci_epf_add_vepf(epf_pf, epf_vf) // add again, -EBUSY error Fix by clearing epf_vf->epf_pf in pci_epf_remove_vepf(). Link: https://lore.kernel.org/r/[email protected] Fixes: 1cf362e ("PCI: endpoint: Add support to add virtual function in endpoint core") Signed-off-by: Zijun Hu <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Frank Li <[email protected]> Cc: [email protected]
1 parent e0be851 commit 3b9f942

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/pci/endpoint/pci-epf-core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ void pci_epf_remove_vepf(struct pci_epf *epf_pf, struct pci_epf *epf_vf)
202202

203203
mutex_lock(&epf_pf->lock);
204204
clear_bit(epf_vf->vfunc_no, &epf_pf->vfunction_num_map);
205+
epf_vf->epf_pf = NULL;
205206
list_del(&epf_vf->list);
206207
mutex_unlock(&epf_pf->lock);
207208
}

0 commit comments

Comments
 (0)