* [PATCH bpf-next] ipv6: fix warning messages in fib6_info_release().
@ 2023-12-07 19:50 thinker.li
2023-12-07 20:04 ` Eric Dumazet
0 siblings, 1 reply; 3+ messages in thread
From: thinker.li @ 2023-12-07 19:50 UTC (permalink / raw)
To: netdev, martin.lau, kernel-team, davem, kuba, pabeni, dsahern,
edumazet
Cc: sinquersw, kuifeng, Kui-Feng Lee
From: Kui-Feng Lee <thinker.li@gmail.com>
The previous patch doesn't handle the case in ip6_route_info_create().
Move calling to fib6_set_expires_locked() to the end of the function to
avoid the false alarm of the previous patch.
Fixes: 5a08d0065a91 ("ipv6: add debug checks in fib6_info_release()")
Suggested-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
---
include/net/ip6_fib.h | 1 -
net/ipv6/route.c | 16 +++++++++-------
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index e1e7a894863a..95ed495c3a40 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -329,7 +329,6 @@ static inline bool fib6_info_hold_safe(struct fib6_info *f6i)
static inline void fib6_info_release(struct fib6_info *f6i)
{
if (f6i && refcount_dec_and_test(&f6i->fib6_ref)) {
- DEBUG_NET_WARN_ON_ONCE(fib6_has_expires(f6i));
DEBUG_NET_WARN_ON_ONCE(!hlist_unhashed(&f6i->gc_link));
call_rcu(&f6i->rcu, fib6_info_destroy_rcu);
}
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index b132feae3393..398dbfb6e12b 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -3762,17 +3762,10 @@ static struct fib6_info *ip6_route_info_create(struct fib6_config *cfg,
if (cfg->fc_flags & RTF_ADDRCONF)
rt->dst_nocount = true;
- if (cfg->fc_flags & RTF_EXPIRES)
- fib6_set_expires_locked(rt, jiffies +
- clock_t_to_jiffies(cfg->fc_expires));
- else
- fib6_clean_expires_locked(rt);
-
if (cfg->fc_protocol == RTPROT_UNSPEC)
cfg->fc_protocol = RTPROT_BOOT;
rt->fib6_protocol = cfg->fc_protocol;
- rt->fib6_table = table;
rt->fib6_metric = cfg->fc_metric;
rt->fib6_type = cfg->fc_type ? : RTN_UNICAST;
rt->fib6_flags = cfg->fc_flags & ~RTF_GATEWAY;
@@ -3824,6 +3817,15 @@ static struct fib6_info *ip6_route_info_create(struct fib6_config *cfg,
} else
rt->fib6_prefsrc.plen = 0;
+ if (cfg->fc_flags & RTF_EXPIRES)
+ fib6_set_expires_locked(rt, jiffies +
+ clock_t_to_jiffies(cfg->fc_expires));
+ /* Set fib6_table after fib6_set_expires_locked() to ensure the
+ * gc_link is not inserted until fib6_add() is called to insert the
+ * fib6_info to the fib.
+ */
+ rt->fib6_table = table;
+
return rt;
out:
fib6_info_release(rt);
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH bpf-next] ipv6: fix warning messages in fib6_info_release().
2023-12-07 19:50 [PATCH bpf-next] ipv6: fix warning messages in fib6_info_release() thinker.li
@ 2023-12-07 20:04 ` Eric Dumazet
2023-12-07 20:24 ` Kui-Feng Lee
0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2023-12-07 20:04 UTC (permalink / raw)
To: thinker.li
Cc: netdev, martin.lau, kernel-team, davem, kuba, pabeni, dsahern,
sinquersw, kuifeng
On Thu, Dec 7, 2023 at 8:50 PM <thinker.li@gmail.com> wrote:
>
> From: Kui-Feng Lee <thinker.li@gmail.com>
>
> The previous patch doesn't handle the case in ip6_route_info_create().
> Move calling to fib6_set_expires_locked() to the end of the function to
> avoid the false alarm of the previous patch.
>
> Fixes: 5a08d0065a91 ("ipv6: add debug checks in fib6_info_release()")
This looks quite wrong.
Let's separate things to have clean stable backports.
I will submit my single liner, you will submit a patch fixing your prior commit,
otherwise linux-6.6 and linux-6.7 will still have a bug.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH bpf-next] ipv6: fix warning messages in fib6_info_release().
2023-12-07 20:04 ` Eric Dumazet
@ 2023-12-07 20:24 ` Kui-Feng Lee
0 siblings, 0 replies; 3+ messages in thread
From: Kui-Feng Lee @ 2023-12-07 20:24 UTC (permalink / raw)
To: Eric Dumazet, thinker.li
Cc: netdev, martin.lau, kernel-team, davem, kuba, pabeni, dsahern,
kuifeng
On 12/7/23 12:04, Eric Dumazet wrote:
> On Thu, Dec 7, 2023 at 8:50 PM <thinker.li@gmail.com> wrote:
>>
>> From: Kui-Feng Lee <thinker.li@gmail.com>
>>
>> The previous patch doesn't handle the case in ip6_route_info_create().
>> Move calling to fib6_set_expires_locked() to the end of the function to
>> avoid the false alarm of the previous patch.
>>
>> Fixes: 5a08d0065a91 ("ipv6: add debug checks in fib6_info_release()")
>
> This looks quite wrong.
>
> Let's separate things to have clean stable backports.
>
> I will submit my single liner, you will submit a patch fixing your prior commit,
> otherwise linux-6.6 and linux-6.7 will still have a bug.
Sure, I am working on that.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-12-07 20:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-07 19:50 [PATCH bpf-next] ipv6: fix warning messages in fib6_info_release() thinker.li
2023-12-07 20:04 ` Eric Dumazet
2023-12-07 20:24 ` Kui-Feng Lee
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).