[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iJhX4ny3Se1mz74M5NbiG9NTSbUagTYG0chk-33F_HNvA@mail.gmail.com>
Date: Tue, 10 Sep 2024 08:00:23 +0200
From: Eric Dumazet <edumazet@...gle.com>
To: Jeongjun Park <aha310510@...il.com>
Cc: davem@...emloft.net, dsahern@...nel.org, kuba@...nel.org,
pabeni@...hat.com, kafai@...com, weiwan@...gle.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH net] net: prevent NULL pointer dereference in
rt_fibinfo_free() and rt_fibinfo_free_cpus()
On Tue, Sep 10, 2024 at 5:23 AM Jeongjun Park <aha310510@...il.com> wrote:
>
>
> > Eric Dumazet <edumazet@...gle.com> wrote:
> > On Mon, Sep 9, 2024 at 8:48 PM Jeongjun Park <aha310510@...il.com> wrote:
> >>
> >> rt_fibinfo_free() and rt_fibinfo_free_cpus() only check for rt and do not
> >> verify rt->dst and use it, which will result in NULL pointer dereference.
> >>
> >> Therefore, to prevent this, we need to add a check for rt->dst.
> >>
> >> Fixes: 0830106c5390 ("ipv4: take dst->__refcnt when caching dst in fib")
> >> Fixes: c5038a8327b9 ("ipv4: Cache routes in nexthop exception entries.")
> >> Signed-off-by: Jeongjun Park <aha310510@...il.com>
> >> ---
> >
> > As far as I can tell, your patch is a NOP, and these Fixes: tags seem
> > random to me.
>
> I somewhat agree with the opinion that the fixes tag is random.
> However, I think it is absolutely necessary to add a check for
> &rt->dst , because the existence of rt does not guarantee that
> &rt->dst will not be NULL.
dst is the first field of 'struct rtable'.
Always has been.
Unless your compiler is buggy, (void *)rt == (void *)&rt->dst
Powered by blists - more mailing lists