From: Andrew Lunn Date: Thu, 3 Dec 2015 20:12:30 +0000 (+0100) Subject: WAN: HDLC: Detach protocol before unregistering device X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ff3516442768f0babe7ea2db62e34aee1d76e969;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git WAN: HDLC: Detach protocol before unregistering device 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 Signed-off-by: David S. Miller --- diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c index 51f6cee8aab2..2a6595b4ae15 100644 --- a/drivers/net/wan/hdlc.c +++ b/drivers/net/wan/hdlc.c @@ -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(); }