On Sat, 23 Dec 2000, Andrew Morton wrote:
> This function remains in place. Should only be
> called for an unhidden interface. It closes the device,
> removes the interface from the namespace, notifies protocols
> of the disappearing interface and then calls /sbin/hotplug.
Comments in this function talk about "New style" devices with destructors.
The current implementation blocks until the device reference count reaches
1. The comment appears to imply that at some point in the future this
routine will not block if it detects a new style device. The cleanup will
then be done via the destructor.
However, where the destructor is called in netdev_finish_unregister, the
dev handle is again dereferenced after the destructor has been called.
Does this imply that the destructor cannot be used to deallocate the
device structure (i.e. dev->features & NETIF_F_DYNALLOC = 0)?
Or is the dev handle assume to still be valid?
Or would the patch below be desired?
Or could someone give an indication to what the destructor is allowed to
diff -u4Nr -X dontdiff linux-2.4.0test13pre7.orig/net/core/dev.c
--- linux-2.4.0test13pre7.orig/net/core/dev.c Mon Dec 11 21:29:35 2000
+++ linux-2.4.0test13pre7/net/core/dev.c Sun Dec 31 13:16:41 2000
@@ -2418,8 +2418,10 @@
int netdev_finish_unregister(struct net_device *dev)
+ int features = dev->features;
@@ -2432,9 +2434,9 @@
(dev->features & NETIF_F_DYNALLOC)?"":", old style");
- if (dev->features & NETIF_F_DYNALLOC)
+ if (features & NETIF_F_DYNALLOC)