[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <000b01d2c3a4$d3b91260$7b2b3720$@foxmail.com>
Date: Wed, 3 May 2017 08:33:02 +0800
From: "Gao Feng" <gfree.wind@...mail.com>
To: "'David Miller'" <davem@...emloft.net>
Cc: <jiri@...nulli.us>, <mareklindner@...mailbox.ch>,
<sw@...onwunderlich.de>, <a@...table.cc>, <kuznet@....inr.ac.ru>,
<jmorris@...ei.org>, <yoshfuji@...ux-ipv6.org>, <kaber@...sh.net>,
<steffen.klassert@...unet.com>, <herbert@...dor.apana.org.au>,
<netdev@...r.kernel.org>
Subject: RE: [PATCH net v4 00/12] Fix possbile memleaks when fail to register_netdevice
Hi David
> From: David Miller [mailto:davem@...emloft.net]
> Sent: Wednesday, May 3, 2017 3:30 AM
> From: gfree.wind@...mail.com
> Date: Tue, 2 May 2017 13:58:42 +0800
>
[...]
> >
> > This solution doesn't only make sure free all resources in any case,
> > but also follows the original desgin that some resources could be kept
> > until the destructor executes normally after register the device
> > successfully.
>
> I want to think about this some more.
>
> It is really unfortunate that resources are allocated strictly from the
ndo_init()
> yet released in two different callbacks which are invoked only in certain
> (different) situations.
>
> Just the fact that we have to make an internal netdev state test in the
> ndo_uninit callback to get this right is a big red flag to me.
Yes, I am very agree with you.
This fix is just like a workaround under current framework.
The root is that allocate in one spot, but free them at two spots.
It means all ndo_uninit need to handle this case if allocate some resource
and free them in the destructor.
It should be done by the framework.
I thought about if there was a better solution to fix it.
But I think it need to modify the framework of net_device, it seems not good
as a bug fix to net.git.
Best Regards
Feng
Powered by blists - more mailing lists