[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170728070329-mutt-send-email-mst@kernel.org>
Date: Fri, 28 Jul 2017 07:05:03 +0300
From: "Michael S. Tsirkin" <mst@...hat.com>
To: Jason Wang <jasowang@...hat.com>
Cc: Jakub Kicinski <kubakici@...pl>, davem@...emloft.net,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next 3/3] tap: XDP support
On Fri, Jul 28, 2017 at 11:50:45AM +0800, Jason Wang wrote:
>
>
> On 2017年07月28日 11:46, Michael S. Tsirkin wrote:
> > On Fri, Jul 28, 2017 at 11:28:54AM +0800, Jason Wang wrote:
> > > > > + old_prog = rtnl_dereference(tun->xdp_prog);
> > > > > + if (old_prog)
> > > > > + bpf_prog_put(old_prog);
> > > > > + rcu_assign_pointer(tun->xdp_prog, prog);
> > > > Is this OK? Could this lead to the program getting freed and then
> > > > datapath accessing a stale pointer? I mean in the scenario where the
> > > > process gets pre-empted between the bpf_prog_put() and
> > > > rcu_assign_pointer()?
> > > Will call bpf_prog_put() after rcu_assign_pointer().
> > I suspect you need to sync RCU or something before that.
>
> __bpf_prog_put() will do call_rcu(), so looks like it was ok.
>
> Thanks
True - I missed that.
--
MST
Powered by blists - more mailing lists