]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
PCI: endpoint: Fix swapped parameters in pci_{primary/secondary}_epc_epf_unlink(...
authorManikanta Maddireddy <mmaddireddy@nvidia.com>
Thu, 8 Jan 2026 06:27:47 +0000 (11:57 +0530)
committerBjorn Helgaas <bhelgaas@google.com>
Sat, 24 Jan 2026 00:04:33 +0000 (18:04 -0600)
struct configfs_item_operations callbacks are defined like the following:

  int (*allow_link)(struct config_item *src, struct config_item *target);
  void (*drop_link)(struct config_item *src, struct config_item *target);

While pci_primary_epc_epf_link() and pci_secondary_epc_epf_link() specify
the parameters in the correct order, pci_primary_epc_epf_unlink() and
pci_secondary_epc_epf_unlink() specify the parameters in the wrong order,
leading to the below kernel crash when using the unlink command in
configfs:

  Unable to handle kernel paging request at virtual address 0000000300000857
  Mem abort info:
  ...
  pc : string+0x54/0x14c
  lr : vsnprintf+0x280/0x6e8
  ...
  string+0x54/0x14c
  vsnprintf+0x280/0x6e8
  vprintk_default+0x38/0x4c
  vprintk+0xc4/0xe0
  pci_epf_unbind+0xdc/0x108
  configfs_unlink+0xe0/0x208+0x44/0x74
  vfs_unlink+0x120/0x29c
  __arm64_sys_unlinkat+0x3c/0x90
  invoke_syscall+0x48/0x134
  do_el0_svc+0x1c/0x30prop.0+0xd0/0xf0

Fixes: e85a2d783762 ("PCI: endpoint: Add support in configfs to associate two EPCs with EPF")
Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
[mani: cced stable, changed commit message as per https://lore.kernel.org/linux-pci/aV9joi3jF1R6ca02@ryzen]
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260108062747.1870669-1-mmaddireddy@nvidia.com
drivers/pci/endpoint/pci-ep-cfs.c

index 43feb6139fa36c577405d337367417433885b08e..8b392a8363bb1995e4dc007b8dd14ca449c309b3 100644 (file)
@@ -68,8 +68,8 @@ static int pci_secondary_epc_epf_link(struct config_item *epf_item,
        return 0;
 }
 
-static void pci_secondary_epc_epf_unlink(struct config_item *epc_item,
-                                        struct config_item *epf_item)
+static void pci_secondary_epc_epf_unlink(struct config_item *epf_item,
+                                        struct config_item *epc_item)
 {
        struct pci_epf_group *epf_group = to_pci_epf_group(epf_item->ci_parent);
        struct pci_epc_group *epc_group = to_pci_epc_group(epc_item);
@@ -132,8 +132,8 @@ static int pci_primary_epc_epf_link(struct config_item *epf_item,
        return 0;
 }
 
-static void pci_primary_epc_epf_unlink(struct config_item *epc_item,
-                                      struct config_item *epf_item)
+static void pci_primary_epc_epf_unlink(struct config_item *epf_item,
+                                      struct config_item *epc_item)
 {
        struct pci_epf_group *epf_group = to_pci_epf_group(epf_item->ci_parent);
        struct pci_epc_group *epc_group = to_pci_epc_group(epc_item);