Skip to contentSkip to conversation

ipv6: do not check fib6_has_expires() in fib6_info_release()

PATCH Applied Eric Dumazet 4 participants 4 messages Dec 7, 2023 – Dec 9, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipv6: do not check fib6_has_expires() in fib6_info_release()

My prior patch went a bit too far, because apparently fib6_has_expires() could be true while f6i->gc_link is not hashed yet.

fib6_set_expires_locked() can indeed set RTF_EXPIRES while f6i->fib6_table is NULL.

Original syzbot reports were about corruptions caused by dangling f6i->gc_link.

Fixes 5a08d0065a91 ("ipv6: add debug checks in fib6_info_release()")
Reported-by [email protected]
Cc David Ahern <[email protected]>
Cc Kui-Feng Lee <[email protected]>
---
 include/net/ip6_fib.h | 1 -
 1 file changed, 1 deletion(-)
include/net/ip6_fib.h +0 -1
index e1e7a894863a7891610ce5afb2034473cc208d3e..95ed495c3a4028457baf1503c367d2e7a6e14770 100644
@@ -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);
 	}
Signature · 1 line
2.43.0.472.g3155946c3a-goog
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Eric Dumazet

My prior patch went a bit too far, because apparently fib6_has_expires() could be true while f6i->gc_link is not hashed yet.

yes, and I got distracted by that stack trace and avoiding errors in the create function. The diff I sent does not solve any corruption with list since the newly allocated f6i is not linked (and gc-link is initialized).

Kui-Feng: no need to send that patch again since it is not really changing anything. Let's see if the other warn on triggers.

Quoted 7 lines

fib6_set_expires_locked() can indeed set RTF_EXPIRES while f6i->fib6_table is NULL.

Original syzbot reports were about corruptions caused by dangling f6i->gc_link.

Quoted 9 lines
Fixes 5a08d0065a91 ("ipv6: add debug checks in fib6_info_release()")
Reported-by [email protected]
Cc David Ahern <[email protected]>
Cc Kui-Feng Lee <[email protected]>
---
 include/net/ip6_fib.h | 1 -
 1 file changed, 1 deletion(-)
#2 lore raw
Quoted 10 lines · David Ahern
Quoted 2 lines · Eric Dumazet

My prior patch went a bit too far, because apparently fib6_has_expires() could be true while f6i->gc_link is not hashed yet.

yes, and I got distracted by that stack trace and avoiding errors in the create function. The diff I sent does not solve any corruption with list since the newly allocated f6i is not linked (and gc-link is initialized).

Kui-Feng: no need to send that patch again since it is not really changing anything. Let's see if the other warn on triggers.

Got it!

Quoted 22 lines
Quoted 8 lines

fib6_set_expires_locked() can indeed set RTF_EXPIRES while f6i->fib6_table is NULL.

Original syzbot reports were about corruptions caused by dangling f6i->gc_link.

Quoted 9 lines
Fixes 5a08d0065a91 ("ipv6: add debug checks in fib6_info_release()")
Reported-by [email protected]
Cc David Ahern <[email protected]>
Cc Kui-Feng Lee <[email protected]>
---
  include/net/ip6_fib.h | 1 -
  1 file changed, 1 deletion(-)
#3 lore raw
In reply to Eric Dumazet
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Thu, 7 Dec 2023 20:13:22 +0000 you wrote:

My prior patch went a bit too far, because apparently fib6_has_expires() could be true while f6i->gc_link is not hashed yet.

fib6_set_expires_locked() can indeed set RTF_EXPIRES while f6i->fib6_table is NULL.

Original syzbot reports were about corruptions caused by dangling f6i->gc_link.

[...]

Here is the summary with links:
- [net-next] ipv6: do not check fib6_has_expires() in fib6_info_release()

    https://git.kernel.org/netdev/net-next/c/a3c205d0560f

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html