Re: [PATCH v2 2/2] pci: endpoint: Fix kernel panic after put_device()

From: Andy Shevchenko
Date: Mon Feb 26 2018 - 14:12:16 EST


On Mon, Feb 26, 2018 at 7:16 PM, Rolf Evers-Fischer
<embedded24@xxxxxxxxxxxxxxxx> wrote:
> From: Rolf Evers-Fischer <rolf.evers.fischer@xxxxxxxxx>
>
> 'put_device()' calls the relase function 'pci_epf_dev_release()',
> which already frees 'epf->name' and 'epf'.
>
> Therefore we must not free them again after 'put_device()'.

> put_dev:
> put_device(dev);
> - kfree(epf->name);
> + return ERR_PTR(ret);

Ouch, if it's double free (sounds like it is) it should be fixed up to
initial commit which brought that.
Thus, Fixes tag would be good to see.

--
With Best Regards,
Andy Shevchenko