[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpWvp2i6iOZtSPskqU_uXHL2zKfM_cS1rGTh_T0r3BwvnA@mail.gmail.com>
Date: Mon, 29 Apr 2019 09:58:43 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: "Michael S. Tsirkin" <mst@...hat.com>
Cc: Yue Haibing <yuehaibing@...wei.com>,
David Miller <davem@...emloft.net>,
Jason Wang <jasowang@...hat.com>,
Eric Dumazet <edumazet@...gle.com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
"Li,Rongqing" <lirongqing@...du.com>,
Nicolas Dichtel <nicolas.dichtel@...nd.com>,
Chas Williams <3chas3@...il.com>, wangli39@...du.com,
LKML <linux-kernel@...r.kernel.org>,
Linux Kernel Network Developers <netdev@...r.kernel.org>
Subject: Re: [PATCH] tun: Fix use-after-free in tun_net_xmit
On Mon, Apr 29, 2019 at 7:55 AM Michael S. Tsirkin <mst@...hat.com> wrote:
> The problem seems real enough, but an extra synchronize_net on tun_attach
> might be a problem, slowing guest startup significantly.
> Better ideas?
Yes, I proposed the following patch in the other thread.
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index e9ca1c088d0b..31c3210288cb 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -3431,6 +3431,7 @@ static int tun_chr_open(struct inode *inode,
struct file * file)
file->private_data = tfile;
INIT_LIST_HEAD(&tfile->next);
+ sock_set_flag(&tfile->sk, SOCK_RCU_FREE);
sock_set_flag(&tfile->sk, SOCK_ZEROCOPY);
return 0;
Powered by blists - more mailing lists