diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 93285687cf13ea28ad5627953d91b6d164eab100..9142db847ee156f8e29dab9856cbcc90021ac541 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -2005,7 +2005,11 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, rtnl_lock(); tun = __tun_get(tfile); - if (cmd == TUNSETIFF && !tun) { + if (cmd == TUNSETIFF) { + ret = -EEXIST; + if (tun) + goto unlock; + ifr.ifr_name[IFNAMSIZ-1] = '\0'; ret = tun_set_iff(sock_net(&tfile->sk), file, &ifr);