[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEA6p_BQp1O6jGc+RY2YAHFVC3df7MEm9he7cajUnccVCzkMvw@mail.gmail.com>
Date: Tue, 15 Oct 2019 09:44:11 -0700
From: Wei Wang <weiwan@...gle.com>
To: Jesse Hathaway <jesse@...ki-mvuki.org>
Cc: Ido Schimmel <idosch@...sch.org>, Martin KaFai Lau <kafai@...com>,
Linux Kernel Network Developers <netdev@...r.kernel.org>
Subject: Re: Race condition in route lookup
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.
Then I believe it will be patched into the next 5.4 release automatically?
Powered by blists - more mailing lists