]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
WAN: HDLC: Detach protocol before unregistering device
authorAndrew Lunn <andrew@lunn.ch>
Thu, 3 Dec 2015 20:12:30 +0000 (21:12 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 5 Dec 2015 22:41:41 +0000 (17:41 -0500)
The current code first unregisters the device, and then detaches the
protocol from it. This should be performed the other way around, since
the detach may try to use state which has been freed by the
unregister. Swap the order, so that we first detach and then remove the
netdev.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/wan/hdlc.c

index 51f6cee8aab2d805147b9741ea49fad3747d7cfa..2a6595b4ae15896bf55e212f8946f50b45251147 100644 (file)
@@ -266,8 +266,8 @@ struct net_device *alloc_hdlcdev(void *priv)
 void unregister_hdlc_device(struct net_device *dev)
 {
        rtnl_lock();
-       unregister_netdevice(dev);
        detach_hdlc_protocol(dev);
+       unregister_netdevice(dev);
        rtnl_unlock();
 }