Hello,
The put_device(&epc->dev) call will trigger pci_epc_release() which frees "epc" so the kfree(epc) on the next line is a double free.
Found by code review.
Cc: stable@vger.kernel.org Fixes: 5e8cb4033807 ("PCI: endpoint: Add EP core layer to enable EP controller and EP functions") Signed-off-by: Ma Ke make24@iscas.ac.cn
Which kernel release did you review? I don't see this kfree() when looking at the current code base per:
https://elixir.bootlin.com/linux/v6.13-rc1/source/drivers/pci/endpoint/pci-e...
Krzysztof