diff options
author | David S. Miller <davem@davemloft.net> | 2020-09-22 16:45:34 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-09-22 16:45:34 -0700 |
commit | 255a88e7989ff52c975e8b80de9d746cb107c58e (patch) | |
tree | 58138d2ffdb6a58ffa8bce66a6ae0f7283827883 /drivers/net/wireguard/peerlookup.c | |
parent | 58de2b5dc6e1acc0dfe15dfc5fb863c3aec47566 (diff) | |
parent | a00d10c8fade0f66f0020160cdac7574a9bc49c0 (diff) | |
download | wireguard-linux-trimmed-255a88e7989ff52c975e8b80de9d746cb107c58e.tar.gz wireguard-linux-trimmed-255a88e7989ff52c975e8b80de9d746cb107c58e.zip |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Two minor conflicts:
1) net/ipv4/route.c, adding a new local variable while
moving another local variable and removing it's
initial assignment.
2) drivers/net/dsa/microchip/ksz9477.c, overlapping changes.
One pretty prints the port mode differently, whilst another
changes the driver to try and obtain the port mode from
the port node rather than the switch node.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireguard/peerlookup.c')
-rw-r--r-- | drivers/net/wireguard/peerlookup.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/net/wireguard/peerlookup.c b/drivers/net/wireguard/peerlookup.c index e4deb33..f2783aa 100644 --- a/drivers/net/wireguard/peerlookup.c +++ b/drivers/net/wireguard/peerlookup.c @@ -167,9 +167,13 @@ bool wg_index_hashtable_replace(struct index_hashtable *table, struct index_hashtable_entry *old, struct index_hashtable_entry *new) { - if (unlikely(hlist_unhashed(&old->index_hash))) - return false; + bool ret; + spin_lock_bh(&table->lock); + ret = !hlist_unhashed(&old->index_hash); + if (unlikely(!ret)) + goto out; + new->index = old->index; hlist_replace_rcu(&old->index_hash, &new->index_hash); @@ -180,8 +184,9 @@ bool wg_index_hashtable_replace(struct index_hashtable *table, * simply gets dropped, which isn't terrible. */ INIT_HLIST_NODE(&old->index_hash); +out: spin_unlock_bh(&table->lock); - return true; + return ret; } void wg_index_hashtable_remove(struct index_hashtable *table, |