瀏覽代碼

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 <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Andrew Lunn 9 年之前
父節點
當前提交
ff35164427
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/net/wan/hdlc.c

+ 1 - 1
drivers/net/wan/hdlc.c

@@ -266,8 +266,8 @@ struct net_device *alloc_hdlcdev(void *priv)
 void unregister_hdlc_device(struct net_device *dev)
 void unregister_hdlc_device(struct net_device *dev)
 {
 {
 	rtnl_lock();
 	rtnl_lock();
-	unregister_netdevice(dev);
 	detach_hdlc_protocol(dev);
 	detach_hdlc_protocol(dev);
+	unregister_netdevice(dev);
 	rtnl_unlock();
 	rtnl_unlock();
 }
 }