Re: [PATCH] drm/imx: fix memory leak in imx_pd_bind
From: Navid Emamdoost
Date: Sat Oct 12 2019 - 15:22:33 EST
No, that is not correct! You should not try to free imxpd here as it
is a resource-managed allocation via devm_kzalloc(). It means memory
allocated with this function is automatically freed on driver detach.
So, this patch introduces a double-free.
On Sat, Oct 12, 2019 at 6:54 AM Markus Elfring <Markus.Elfring@xxxxxx> wrote:
>
> > +free_edid:
> > + kfree(imxpd->edid);
> > + return ret;
>
> I have taken another look at this change idea.
> Can the function call âdevm_kfree(dev, imxpd)â become relevant
> also at this place?
>
> Would you like to combine it with the update suggestion
> âFix error handling for a kmemdup() call in imx_pd_bind()â?
> https://lore.kernel.org/r/3fd6aa8b-2529-7ff5-3e19-05267101b2a4@xxxxxx/
> https://lore.kernel.org/patchwork/patch/1138912/
> https://lkml.org/lkml/2019/10/12/87
>
> Regards,
> Markus
--
Navid.