]> git.hungrycats.org Git - linux/commit
PCI: endpoint: Clear secondary (not primary) EPC in pci_epc_remove_epf()
authorZijun Hu <quic_zijuhu@quicinc.com>
Thu, 7 Nov 2024 00:53:09 +0000 (08:53 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 Dec 2024 09:41:07 +0000 (10:41 +0100)
commita143b50de2b819c124d52ec35fa03c05ebd467a4
treeda751ae10ab7a131403a5ab85406823562d95b94
parentc74a1df6c2a2df7dd45c3fc1a5edc29a075dcf22
PCI: endpoint: Clear secondary (not primary) EPC in pci_epc_remove_epf()

commit 688d2eb4c6fcfdcdaed0592f9df9196573ff5ce2 upstream.

In addition to a primary endpoint controller, an endpoint function may be
associated with a secondary endpoint controller, epf->sec_epc, to provide
NTB (non-transparent bridge) functionality.

Previously, pci_epc_remove_epf() incorrectly cleared epf->epc instead of
epf->sec_epc when removing from the secondary endpoint controller.

Extend the epc->list_lock coverage and clear either epf->epc or
epf->sec_epc as indicated.

Link: https://lore.kernel.org/r/20241107-epc_rfc-v2-2-da5b6a99a66f@quicinc.com
Fixes: 63840ff53223 ("PCI: endpoint: Add support to associate secondary EPC with EPF")
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
[mani: reworded subject and description]
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
[bhelgaas: commit log]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Krzysztof WilczyƄski <kwilczynski@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/pci/endpoint/pci-epc-core.c