Re: [PATCH] PCI: endpoint: Fix a double free in __pci_epc_create()

From: Krzysztof Wilczyński
Date: Thu Feb 20 2025 - 11:28:59 EST


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-epc-core.c#L956-L1020

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