diff --git a/drivers/net/tun.c b/drivers/net/tun.c index a1b0697..0af7ceb 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -173,6 +173,8 @@ static void __tun_detach(struct tun_struct *tun) tun->tfile = NULL; netif_tx_unlock_bh(tun->dev); + tun->sk->sk_sleep = NULL; + /* Drop read queue */ skb_queue_purge(&tun->readq); @@ -873,6 +875,9 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) else return -EINVAL; + sk = tun->sk; + sk->sk_sleep = &tfile->read_wait; + err = tun_attach(tun, file); if (err < 0) return err;