]> Gentwo Git Trees - linux/.git/commit
neighbour: Convert RTM_SETNEIGHTBL to RCU.
authorKuniyuki Iwashima <kuniyu@google.com>
Wed, 22 Oct 2025 05:39:48 +0000 (05:39 +0000)
committerJakub Kicinski <kuba@kernel.org>
Sat, 25 Oct 2025 00:57:20 +0000 (17:57 -0700)
commit55a6046b48a8c7d3ea164d9b68902b4ea6930cf3
tree832a0ac79f902510d0273226383681b873193960
parent4ae34be500649ec452ac1fc2748958683ad9b55d
neighbour: Convert RTM_SETNEIGHTBL to RCU.

neightbl_set() fetches neigh_tables[] and updates attributes under
write_lock_bh(&tbl->lock), so RTNL is not needed.

neigh_table_clear() synchronises RCU only, and rcu_dereference_rtnl()
protects nothing here.

If we released RCU after fetching neigh_tables[], there would be no
synchronisation to block neigh_table_clear() further, so RCU is held
until the end of the function.

Another option would be to protect neigh_tables[] user with SRCU
and add synchronize_srcu() in neigh_table_clear().

But, holding RCU should be fine as we hold write_lock_bh() for the
rest of neightbl_set() anyway.

Let's perform RTM_SETNEIGHTBL under RCU and drop RTNL.

Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20251022054004.2514876-5-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/neighbour.c