netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kui-Feng Lee <sinquersw@gmail.com>
To: David Ahern <dsahern@kernel.org>,
	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, edumazet@google.com
Cc: kuifeng@meta.com, syzbot+c15aa445274af8674f41@syzkaller.appspotmail.com
Subject: Re: [PATCH net-next v2 1/2] net/ipv6: insert a f6i to a GC list only if the f6i is in a fib6_table tree.
Date: Fri, 8 Dec 2023 15:19:28 -0800	[thread overview]
Message-ID: <92dcf735-6e9c-48dc-a020-d4e2658dff19@gmail.com> (raw)
In-Reply-To: <353fc304-389b-4c16-b78f-20128d688370@kernel.org>



On 12/8/23 14:43, David Ahern wrote:
> On 12/8/23 12:45 PM, thinker.li@gmail.com wrote:
>> From: Kui-Feng Lee <thinker.li@gmail.com>
>>
>> Check f6i->fib6_node and hlist_unhashed(&f6i->gc_link) before inserting a
>> f6i (fib6_info) to tb6_gc_hlist.
>>
>> The current implementation checks if f6i->fib6_table is not NULL to
>> determines if a f6i is on a tree, however it is not enough. When a f6i is
>> removed from a fib6_table, f6i->fib6_table is not reset. However, fib6_node
>> is always reset when a f6i is removed from a fib6_table and is set when a
>> f6i is added to a fib6_table. So, f6i->fib6_node is a reliable way to
>> determine if a f6i is on a tree.
> 
> Which is an indication that the table is not the right check but neither
> is the fib6_node. If expires is set on a route entry, add it to the
> gc_list; if expires is reset on a route entry, remove it from the
> gc_list. If the value of expires is changed while on the gc_list list,
> just update the expires value.
> 

I don't quite follow you.
If an entry is not on a tree, why do we still add the entry to the gc 
list? (This is the reason to check f6i->fib6_node.)

The changes in this patch rely on two indications, 1. if a f6i is on a 
tree, 2. if a f6i is on a gc list (described in the 3rd paragraph of
the comment log.)
An entry is added to a gc list only if it has expires and is not on the 
list yet. An entry is removed from a gc list only if it is on a gc list.
And, just like what you said earlier, it just updates the expires value
while an entry is already on a gc list.

  reply	other threads:[~2023-12-08 23:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-08 19:45 [PATCH net-next v2 0/2] Fix dangling pointer at f6i->gc_link thinker.li
2023-12-08 19:45 ` [PATCH net-next v2 1/2] net/ipv6: insert a f6i to a GC list only if the f6i is in a fib6_table tree thinker.li
2023-12-08 22:43   ` David Ahern
2023-12-08 23:19     ` Kui-Feng Lee [this message]
2023-12-08 23:38       ` Kui-Feng Lee
2023-12-08 19:45 ` [PATCH net-next v2 2/2] selftests: fib_tests: Add tests for toggling between w/ and w/o expires thinker.li
2023-12-12  2:20   ` Hangbin Liu
2023-12-12  2:40     ` Kui-Feng Lee
2023-12-12  5:35       ` Hangbin Liu
2023-12-12 16:24         ` Kui-Feng Lee
2023-12-13 17:22 ` [PATCH net-next v2 0/2] Fix dangling pointer at f6i->gc_link David Ahern
2023-12-13 17:32   ` Eric Dumazet
2023-12-13 19:37     ` David Ahern

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=92dcf735-6e9c-48dc-a020-d4e2658dff19@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).