Netdev List
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: Ren Wei <enjou1224z@gmail.com>
Cc: netdev@vger.kernel.org, dsahern@kernel.org, davem@davemloft.net,
	edumazet@google.com, pabeni@redhat.com, horms@kernel.org,
	Jason@zx2c4.com, vega@nebusec.ai, zhilinz@nebusec.ai
Subject: Re: [PATCH net 1/1] net: ipv6: clear suppressed fib6 rule result
Date: Sun, 26 Jul 2026 15:16:35 +0300	[thread overview]
Message-ID: <20260726121635.GA313345@shredder> (raw)
In-Reply-To: <4b8acb7787d54e440155585dd32ebdf0bef7d122.1784710966.git.zhilinz@nebusec.ai>

On Fri, Jul 24, 2026 at 12:48:52AM +0800, Ren Wei wrote:
> From: Zhiling Zou <zhilinz@nebusec.ai>
> 
> fib6_rule_suppress() drops a suppressed route with ip6_rt_put_flags(),
> but leaves res->rt6 pointing at the released rt6_info.
> 
> If no later rule supplies a replacement, fib6_rule_lookup() still sees
> res.rt6 and returns that stale dst to its caller. A suppressing rule can
> therefore leak a released route back to rt6_lookup(), and the next put
> hits rcuref_put_slowpath() from dst_release().
> 
> Clear res->rt6 when suppressing the route so suppressed lookups fall
> through to the null dst instead of reusing the released one.
> 
> Fixes: cdef485217d3 ("ipv6: fix memory leak in fib6_rule_suppress")

Doesn't matter in practice given this commit was backported, but it
seems that the bug was introduced by commit 7764a45a8f1f ("fib_rules:
add .suppress operation").

> Cc: stable@vger.kernel.org
> Reported-by: Vega <vega@nebusec.ai>
> Assisted-by: Codex:gpt-5.4
> Signed-off-by: Zhiling Zou <zhilinz@nebusec.ai>
> Signed-off-by: Ren Wei <enjou1224z@gmail.com>

Reviewed-by: Ido Schimmel <idosch@nvidia.com>

> ---
>  net/ipv6/fib6_rules.c | 1 +
>  1 file changed, 1 insertion(+)

AFAICT, IPv4 doesn't suffer from this bug given that:

1. fib4_rule_suppress() only drops the reference from the FIB info when
FIB_LOOKUP_NOREF is not set and it is always set by fib_lookup().

2. Unlike fib6_rule_lookup(), __fib_lookup() doesn't ignore the return
value of fib_rules_lookup() and propagates it to the callers.

      reply	other threads:[~2026-07-26 12:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23 16:48 [PATCH net 0/1] net: ipv6: clear suppressed fib6 rule result Ren Wei
2026-07-23 16:48 ` [PATCH net 1/1] " Ren Wei
2026-07-26 12:16   ` Ido Schimmel [this message]

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=20260726121635.GA313345@shredder \
    --to=idosch@nvidia.com \
    --cc=Jason@zx2c4.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=enjou1224z@gmail.com \
    --cc=horms@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vega@nebusec.ai \
    --cc=zhilinz@nebusec.ai \
    /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