Subject: RE: [PATCH net] driver/net: Fix possible memleaks when fail to register_netdevice

From: "Gao Feng" <[email-masked]>
Date: Thu, 27 Apr 2017 16:33:09 +0800

> From: Herbert Xu [mailto:[email-masked]]
> Sent: Thursday, April 27, 2017 4:16 PM
> On Tue, Apr 25, 2017 at 08:01:50PM +0800, [email-masked] wrote:
> > From: Gao Feng <[email-masked]>
> >
[...]
> 
> This has the potential of creating future bugs, because there is no
guarantee
> that the ndo_init function has been invoked at all.
> 
> Wouldn't it be safer to move the freeing from the destructors into their
> ndo_uninit functions instead?

I considered about this solution, I am not sure if it is safe to move the
freeing from destructors into ndo_uninit.
Because when the free action is done in ndo_uninit, it is earlier than
destructor. 
I am not sure if it break the design of original driver.

I just tested the team driver before. It is ok to free all mems in
ndo_uninit.
Is it possible that anyone are using the net_dev after ndo_uninit ?

If no one, i would like to update the patch. 
Could you give me some guide please?

Regards
Feng

> Thanks,
> --