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

[NET]: Fix spurious kfree and missed initialization in TUN driver.

parent 0f883b8d
...@@ -404,6 +404,7 @@ static int tun_set_iff(struct file *file, struct ifreq *ifr) ...@@ -404,6 +404,7 @@ static int tun_set_iff(struct file *file, struct ifreq *ifr)
return -ENOMEM; return -ENOMEM;
tun = dev->priv; tun = dev->priv;
tun->dev = dev;
tun->flags = flags; tun->flags = flags;
if (strchr(dev->name, '%')) { if (strchr(dev->name, '%')) {
...@@ -566,8 +567,6 @@ static int tun_chr_close(struct inode *inode, struct file *file) ...@@ -566,8 +567,6 @@ static int tun_chr_close(struct inode *inode, struct file *file)
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