Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Andrew Lunn and committed by
David S. Miller
ff351644 2141eaf0

+1 -1
+1 -1
drivers/net/wan/hdlc.c
··· 266 266 void unregister_hdlc_device(struct net_device *dev) 267 267 { 268 268 rtnl_lock(); 269 - unregister_netdevice(dev); 270 269 detach_hdlc_protocol(dev); 270 + unregister_netdevice(dev); 271 271 rtnl_unlock(); 272 272 } 273 273