diff options
author | Antonio Quartulli <antonio@open-mesh.com> | 2014-01-29 11:25:12 +0100 |
---|---|---|
committer | Antonio Quartulli <antonio@meshcoding.com> | 2014-02-17 17:17:01 +0100 |
commit | 08bf0ed29c7ded45c477d08618220dd200c3524a (patch) | |
tree | 102dc9b539fb06435727c592c720d17fc62ddbb9 /net/batman-adv/originator.h | |
parent | f1791425cf0bcda43ab9a9a37df1ad3ccb1f6654 (diff) | |
download | linux-08bf0ed29c7ded45c477d08618220dd200c3524a.tar.bz2 |
batman-adv: avoid potential race condition when adding a new neighbour
When adding a new neighbour it is important to atomically
perform the following:
- check if the neighbour already exists
- append the neighbour to the proper list
If the two operations are not performed in an atomic context
it is possible that two concurrent insertions add the same
neighbour twice.
Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Diffstat (limited to 'net/batman-adv/originator.h')
-rw-r--r-- | net/batman-adv/originator.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/batman-adv/originator.h b/net/batman-adv/originator.h index 37be290f63f6..db3a9ed734cb 100644 --- a/net/batman-adv/originator.h +++ b/net/batman-adv/originator.h @@ -29,6 +29,10 @@ void batadv_orig_node_free_ref_now(struct batadv_orig_node *orig_node); struct batadv_orig_node *batadv_orig_node_new(struct batadv_priv *bat_priv, const uint8_t *addr); struct batadv_neigh_node * +batadv_neigh_node_get(const struct batadv_orig_node *orig_node, + const struct batadv_hard_iface *hard_iface, + const uint8_t *addr); +struct batadv_neigh_node * batadv_neigh_node_new(struct batadv_hard_iface *hard_iface, const uint8_t *neigh_addr, struct batadv_orig_node *orig_node); |