mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 11:33:28 +02:00
neighbour: Use rcu_dereference() in pneigh_get_{first,next}().
Now pneigh_entry is guaranteed to be alive during the
RCU critical section even without holding tbl->lock.
Let's use rcu_dereference() in pneigh_get_{first,next}().
Note that neigh_seq_start() still holds tbl->lock for the
normal neighbour entry.
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20250716221221.442239-12-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
32d5eaabf1
commit
b9c89fa128
|
|
@ -3309,10 +3309,10 @@ static struct pneigh_entry *pneigh_get_first(struct seq_file *seq)
|
|||
|
||||
state->flags |= NEIGH_SEQ_IS_PNEIGH;
|
||||
for (bucket = 0; bucket <= PNEIGH_HASHMASK; bucket++) {
|
||||
pn = rcu_dereference_protected(tbl->phash_buckets[bucket], 1);
|
||||
pn = rcu_dereference(tbl->phash_buckets[bucket]);
|
||||
|
||||
while (pn && !net_eq(pneigh_net(pn), net))
|
||||
pn = rcu_dereference_protected(pn->next, 1);
|
||||
pn = rcu_dereference(pn->next);
|
||||
if (pn)
|
||||
break;
|
||||
}
|
||||
|
|
@ -3330,17 +3330,17 @@ static struct pneigh_entry *pneigh_get_next(struct seq_file *seq,
|
|||
struct neigh_table *tbl = state->tbl;
|
||||
|
||||
do {
|
||||
pn = rcu_dereference_protected(pn->next, 1);
|
||||
pn = rcu_dereference(pn->next);
|
||||
} while (pn && !net_eq(pneigh_net(pn), net));
|
||||
|
||||
while (!pn) {
|
||||
if (++state->bucket > PNEIGH_HASHMASK)
|
||||
break;
|
||||
|
||||
pn = rcu_dereference_protected(tbl->phash_buckets[state->bucket], 1);
|
||||
pn = rcu_dereference(tbl->phash_buckets[state->bucket]);
|
||||
|
||||
while (pn && !net_eq(pneigh_net(pn), net))
|
||||
pn = rcu_dereference_protected(pn->next, 1);
|
||||
pn = rcu_dereference(pn->next);
|
||||
if (pn)
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user