]> git.baikalelectronics.ru Git - kernel.git/commit
batman-adv: Prevent duplicated gateway_node entry
authorSven Eckelmann <sven@narfation.org>
Sun, 12 Aug 2018 19:04:41 +0000 (21:04 +0200)
committerSimon Wunderlich <sw@simonwunderlich.de>
Thu, 6 Sep 2018 11:55:20 +0000 (13:55 +0200)
commit6e1e212c5bd7bf7247e784f44bd797805d7bdc91
treeedb50bc7ab394d558b537397645dc7600c21e473
parent74a8ea6df8dbfbbe59b5b3f41b0737d9ef0c1c42
batman-adv: Prevent duplicated gateway_node entry

The function batadv_gw_node_add is responsible for adding new gw_node to
the gateway_list. It is expecting that the caller already checked that
there is not already an entry with the same key or not.

But the lock for the list is only held when the list is really modified.
This could lead to duplicated entries because another context could create
an entry with the same key between the check and the list manipulation.

The check and the manipulation of the list must therefore be in the same
locked code section.

Fixes: b01d4991e36e ("net: Add batman-adv meshing protocol")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Acked-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
net/batman-adv/gateway_client.c