[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191016063928.rwxe65paunw3jwel@kafai-mbp.dhcp.thefacebook.com>
Date: Wed, 16 Oct 2019 06:39:31 +0000
From: Martin Lau <kafai@...com>
To: Wei Wang <weiwan@...gle.com>
CC: Jesse Hathaway <jesse@...ki-mvuki.org>,
Ido Schimmel <idosch@...sch.org>,
Linux Kernel Network Developers <netdev@...r.kernel.org>
Subject: Re: Race condition in route lookup
On Tue, Oct 15, 2019 at 09:44:11AM -0700, Wei Wang wrote:
> On Tue, Oct 15, 2019 at 7:29 AM Jesse Hathaway <jesse@...ki-mvuki.org> wrote:
> >
> > On Fri, Oct 11, 2019 at 12:54 PM Wei Wang <weiwan@...gle.com> wrote:
> > > Hmm... Yes... I would think a per-CPU input cache should work for the
> > > case above.
> > > Another idea is: instead of calling dst_dev_put() in rt_cache_route()
> > > to switch out the dev, we call, rt_add_uncached_list() to add this
> > > obsolete dst cache to the uncached list. And if the device gets
> > > unregistered, rt_flush_dev() takes care of all dst entries in the
> > > uncached list. I think that would work too.
> > >
> > > diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> > > index dc1f510a7c81..ee618d4234ce 100644
> > > --- a/net/ipv4/route.c
> > > +++ b/net/ipv4/route.c
> > > @@ -1482,7 +1482,7 @@ static bool rt_cache_route(struct fib_nh_common
> > > *nhc, struct rtable *rt)
> > > prev = cmpxchg(p, orig, rt);
> > > if (prev == orig) {
> > > if (orig) {
> > > - dst_dev_put(&orig->dst);
> > > + rt_add_uncached_list(orig);
> > > dst_release(&orig->dst);
> > > }
> > > } else {
> > >
> >
> > Thanks Wei for your work on this issue,
> >
> > Any chance this patch will make it into 5.4?
>
> I can submit the patch to NET branch if everyone agrees with this one liner fix.
Acked-by: Martin KaFai Lau <kafai@...com>
I don't think it is a very critical bug though. Not sure
how far it should be ported.
> Then I believe it will be patched into the next 5.4 release automatically?
Powered by blists - more mailing lists