Thread (18 messages) flat view 18 messages, 3 authors, 2017-05-08

RE: [PATCH net v4 00/12] Fix possbile memleaks when fail to register_netdevice

From: Gao Feng <hidden>
Date: 2017-05-03 00:33:14

Hi David
From: David Miller [mailto:davem@davemloft.net]
Sent: Wednesday, May 3, 2017 3:30 AM
From: gfree.wind@foxmail.com
Date: Tue,  2 May 2017 13:58:42 +0800
[...]
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help