Commit cbe7defa authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

[NET]: Fix device unregister in TUN driver.

parent cd290c4a
...@@ -551,10 +551,12 @@ static int tun_chr_close(struct inode *inode, struct file *file) ...@@ -551,10 +551,12 @@ static int tun_chr_close(struct inode *inode, struct file *file)
if (!(tun->flags & TUN_PERSIST)) { if (!(tun->flags & TUN_PERSIST)) {
dev_close(&tun->dev); dev_close(&tun->dev);
unregister_netdevice(&tun->dev); unregister_netdevice(&tun->dev);
kfree(tun);
} }
rtnl_unlock(); rtnl_unlock();
if (!(tun->flags & TUN_PERSIST))
kfree(tun);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment