public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: Jakub Kicinski <kuba@kernel.org>, davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
	andrew+netdev@lunn.ch, horms@kernel.org
Subject: Re: [PATCH net] ipv6: fix NULL pointer deref in ip6_rt_get_dev_rcu()
Date: Mon, 2 Mar 2026 17:09:25 -0700	[thread overview]
Message-ID: <8040efce-34fd-4758-939a-bbeeacbfce12@kernel.org> (raw)
In-Reply-To: <20260301194548.927324-1-kuba@kernel.org>

On 3/1/26 12:45 PM, Jakub Kicinski wrote:
> l3mdev_master_dev_rcu() can return NULL when the slave device is being
> un-slaved from a VRF. All other callers deal with this, but we lost
> the fallback to loopback in ip6_rt_pcpu_alloc() -> ip6_rt_get_dev_rcu()
> with commit 4832c30d5458 ("net: ipv6: put host and anycast routes on
> device with address").
> 
>   KASAN: null-ptr-deref in range [0x0000000000000108-0x000000000000010f]
>   RIP: 0010:ip6_rt_pcpu_alloc (net/ipv6/route.c:1418)
>   Call Trace:
>    ip6_pol_route (net/ipv6/route.c:2318)
>    fib6_rule_lookup (net/ipv6/fib6_rules.c:115)
>    ip6_route_output_flags (net/ipv6/route.c:2607)
>    vrf_process_v6_outbound (drivers/net/vrf.c:437)
> 
> I was tempted to rework the un-slaving code to clear the flag first
> and insert synchronize_rcu() before we remove the upper. But looks like
> the explicit fallback to loopback_dev is an established pattern.
> And I guess avoiding the synchronize_rcu() is nice, too.
> 
> Fixes: 4832c30d5458 ("net: ipv6: put host and anycast routes on device with address")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> now that NIPA is not full of the tc-action.sh crashes this 1 in ~30 runs
> crash in fcnal_ipv6.sh pops out quite clearly.
> 
> CC: dsahern@kernel.org
> ---
>  net/ipv6/route.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 

Reviewed-by: David Ahern <dsahern@kernel.org>


  parent reply	other threads:[~2026-03-03  0:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-01 19:45 [PATCH net] ipv6: fix NULL pointer deref in ip6_rt_get_dev_rcu() Jakub Kicinski
2026-03-02  1:38 ` David Ahern
2026-03-02 14:43   ` Jakub Kicinski
2026-03-03  0:09 ` David Ahern [this message]
2026-03-04  1:30 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8040efce-34fd-4758-939a-bbeeacbfce12@kernel.org \
    --to=dsahern@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox