summaryrefslogtreecommitdiff
path: root/net/nsh/nsh.c
diff options
context:
space:
mode:
authorKuniyuki Iwashima <kuniyu@google.com>2025-07-16 22:08:12 +0000
committerJakub Kicinski <kuba@kernel.org>2025-07-17 16:25:20 -0700
commitd539d8fbd8fcf64a1492c51f5ee99aaa8a8dc9ab (patch)
treedda874417e9d21e8e3bc0358a02b31da5401c9ea /net/nsh/nsh.c
parentd63382aea70aa4ecb516126e00930bc8ab5e55ef (diff)
neighbour: Free pneigh_entry after RCU grace period.
We will convert RTM_GETNEIGH to RCU. neigh_get() looks up pneigh_entry by pneigh_lookup() and passes it to pneigh_fill_info(). Then, we must ensure that the entry is alive till pneigh_fill_info() completes, but read_lock_bh(&tbl->lock) in pneigh_lookup() does not guarantee that. Also, we will convert all readers of tbl->phash_buckets[] to RCU. Let's use call_rcu() to free pneigh_entry and update phash_buckets[] and ->next by rcu_assign_pointer(). pneigh_ifdown_and_unlock() uses list_head to avoid overwriting ->next and moving RCU iterators to another list. pndisc_destructor() (only IPv6 ndisc uses this) uses a mutex, so it is not delayed to call_rcu(), where we cannot sleep. This is fine because the mcast code works with RCU and ipv6_dev_mc_dec() frees mcast objects after RCU grace period. While at it, we change the return type of pneigh_ifdown_and_unlock() to void. Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20250716221221.442239-8-kuniyu@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/nsh/nsh.c')
0 files changed, 0 insertions, 0 deletions