[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241210-pci-epc-core_fix-v3-3-4d86dd573e4b@quicinc.com>
Date: Tue, 10 Dec 2024 22:00:20 +0800
From: Zijun Hu <zijun_hu@...oud.com>
To: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
Krzysztof WilczyĆski <kw@...ux.com>,
Kishon Vijay Abraham I <kishon@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>, Joao Pinto <jpinto@...opsys.com>,
Lorenzo Pieralisi <lpieralisi@...nel.org>,
Wei Yongjun <weiyongjun1@...wei.com>
Cc: Zijun Hu <zijun_hu@...oud.com>, linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org, Zijun Hu <quic_zijuhu@...cinc.com>,
stable@...r.kernel.org
Subject: [PATCH v3 3/3] PCI: endpoint: Fix API pci_epf_add_vepf() returning
-EBUSY error
From: Zijun Hu <quic_zijuhu@...cinc.com>
pci_epf_add_vepf() will suffer -EBUSY error by steps below:
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().
Fixes: 1cf362e907f3 ("PCI: endpoint: Add support to add virtual function in endpoint core")
Cc: stable@...r.kernel.org
Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
---
drivers/pci/endpoint/pci-epf-core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pci/endpoint/pci-epf-core.c b/drivers/pci/endpoint/pci-epf-core.c
index 8fa2797d4169a9f21136bbf73daa818da6c4ac49..50bc2892a36c54aa82c819ac5a9c99e9155d92c1 100644
--- a/drivers/pci/endpoint/pci-epf-core.c
+++ b/drivers/pci/endpoint/pci-epf-core.c
@@ -202,6 +202,7 @@ void pci_epf_remove_vepf(struct pci_epf *epf_pf, struct pci_epf *epf_vf)
mutex_lock(&epf_pf->lock);
clear_bit(epf_vf->vfunc_no, &epf_pf->vfunction_num_map);
+ epf_vf->epf_pf = NULL;
list_del(&epf_vf->list);
mutex_unlock(&epf_pf->lock);
}
--
2.34.1
Powered by blists - more mailing lists