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.
[...]
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...
I will answer my own question. This surplus kfree() has already been removed as part of the following commit:
c9501d268944 ("PCI: endpoint: Fix double free in __pci_epc_create()")
Nevertheless, thank you for the patch.
Krzysztof