diff options
-rw-r--r-- | drivers/net/tun.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index aa963c44450a..a36b56f0940b 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -488,8 +488,6 @@ static int tun_attach(struct tun_struct *tun, struct file *file) | |||
488 | err = -EINVAL; | 488 | err = -EINVAL; |
489 | if (rtnl_dereference(tfile->tun)) | 489 | if (rtnl_dereference(tfile->tun)) |
490 | goto out; | 490 | goto out; |
491 | if (tfile->detached && tun != tfile->detached) | ||
492 | goto out; | ||
493 | 491 | ||
494 | err = -EBUSY; | 492 | err = -EBUSY; |
495 | if (!(tun->flags & TUN_TAP_MQ) && tun->numqueues == 1) | 493 | if (!(tun->flags & TUN_TAP_MQ) && tun->numqueues == 1) |
@@ -1543,6 +1541,9 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
1543 | struct net_device *dev; | 1541 | struct net_device *dev; |
1544 | int err; | 1542 | int err; |
1545 | 1543 | ||
1544 | if (tfile->detached) | ||
1545 | return -EINVAL; | ||
1546 | |||
1546 | dev = __dev_get_by_name(net, ifr->ifr_name); | 1547 | dev = __dev_get_by_name(net, ifr->ifr_name); |
1547 | if (dev) { | 1548 | if (dev) { |
1548 | if (ifr->ifr_flags & IFF_TUN_EXCL) | 1549 | if (ifr->ifr_flags & IFF_TUN_EXCL) |