netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kui-Feng Lee <sinquersw@gmail.com>
To: thinker.li@gmail.com, netdev@vger.kernel.org,
	martin.lau@linux.dev, kernel-team@meta.com, davem@davemloft.net,
	kuba@kernel.org, pabeni@redhat.com, dsahern@kernel.org,
	edumazet@google.com
Cc: kuifeng@meta.com, syzbot+c15aa445274af8674f41@syzkaller.appspotmail.com
Subject: Re: [PATCH net-next] net/ipv6: insert the fib6 gc_link of a fib6_info only if in fib6.
Date: Thu, 7 Dec 2023 14:19:11 -0800	[thread overview]
Message-ID: <2b89a3c1-59fe-4ba6-82de-6f01fbdcdb7f@gmail.com> (raw)
In-Reply-To: <20231207221627.746324-1-thinker.li@gmail.com>

Eric Dumazet, could you help to check if the patch works from your side
with syzbot? Thanks a lot!


On 12/7/23 14:16, thinker.li@gmail.com wrote:
> From: Kui-Feng Lee <thinker.li@gmail.com>
> 
> Check f6i->fib6_node before inserting a f6i (fib6_info) to tb6_gc_hlist.
> 
> Previously, it checks only if f6i->fib6_table is not NULL, however it is
> not enough. When a f6i is removed from a fib6_table, it's fib6_table is not
> going to be reset. fib6_node is always reset when a f6i is removed from a
> fib6_table and set when a f6i is added to a fib6_table. By checking
> fib6_node, adding a f6i t0 tb6_gc_hlist only if f6i is in the table will be
> enforced.
> 
> Fixes: 3dec89b14d37 ("net/ipv6: Remove expired routes with a separated list of routes.")
> Reported-by: syzbot+c15aa445274af8674f41@syzkaller.appspotmail.com
> Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: dsahern@kernel.org
> ---
>   include/net/ip6_fib.h | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
> index 95ed495c3a40..8477c9ff67ac 100644
> --- a/include/net/ip6_fib.h
> +++ b/include/net/ip6_fib.h
> @@ -512,7 +512,10 @@ static inline void fib6_set_expires_locked(struct fib6_info *f6i,
>   
>   	tb6 = f6i->fib6_table;
>   	f6i->expires = expires;
> -	if (tb6 && !fib6_has_expires(f6i))
> +	if (tb6 &&
> +	    rcu_dereference_protected(f6i->fib6_node,
> +				      lockdep_is_held(&tb6->tb6_lock)) &&
> +	    !fib6_has_expires(f6i))
>   		hlist_add_head(&f6i->gc_link, &tb6->tb6_gc_hlist);
>   	f6i->fib6_flags |= RTF_EXPIRES;
>   }

  reply	other threads:[~2023-12-07 22:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07 22:16 [PATCH net-next] net/ipv6: insert the fib6 gc_link of a fib6_info only if in fib6 thinker.li
2023-12-07 22:19 ` Kui-Feng Lee [this message]
2023-12-07 23:17 ` David Ahern
2023-12-07 23:20   ` David Ahern
2023-12-07 23:33     ` Kui-Feng Lee
2023-12-08  1:02       ` David Ahern
2023-12-08  1:16         ` Kui-Feng Lee
2023-12-08  1:23           ` David Ahern
2023-12-08  2:30             ` Kui-Feng Lee
2023-12-08  1:03 ` Kui-Feng Lee

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=2b89a3c1-59fe-4ba6-82de-6f01fbdcdb7f@gmail.com \
    --to=sinquersw@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=kernel-team@meta.com \
    --cc=kuba@kernel.org \
    --cc=kuifeng@meta.com \
    --cc=martin.lau@linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzbot+c15aa445274af8674f41@syzkaller.appspotmail.com \
    --cc=thinker.li@gmail.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;
as well as URLs for NNTP newsgroup(s).