RE: [net PATCH] net: fec: free fec queue when fec_enet_mii_init() fails

From: Wei Fang
Date: Wed May 22 2024 - 03:28:21 EST



> -----Original Message-----
> From: Andrew Lunn <andrew@xxxxxxx>
> Sent: 2024年5月22日 11:15
> To: Wei Fang <wei.fang@xxxxxxx>
> Cc: Xiaolei Wang <xiaolei.wang@xxxxxxxxxxxxx>; Shenwei Wang
> <shenwei.wang@xxxxxxx>; Clark Wang <xiaoning.wang@xxxxxxx>;
> davem@xxxxxxxxxxxxx; edumazet@xxxxxxxxxx; kuba@xxxxxxxxxx;
> pabeni@xxxxxxxxxx; imx@xxxxxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx;
> linux-kernel@xxxxxxxxxxxxxxx
> Subject: Re: [net PATCH] net: fec: free fec queue when fec_enet_mii_init() fails
>
> > The commit 59d0f7465644 ("net: fec: init multi queue date structure")
> > was the first to introduce this issue, commit 619fee9eb13b
> > ("net: fec: fix the potential memory leak in fec_enet_init() ") fixed
> > this, but it does not seem to be completely fixed.
>
> This fix is also not great, and i would say the initial design is really the problem.
> There needs to be a function which is the opposite of fec_enet_init(). It can
> then be called in the probe cleanup code, and in fec_drv_remove() which also
> appears to leak the queues.
>
Yes, this issue also exists when the fec driver is unbound, maybe Xiaolei can
help improve it in his patch.