batman-adv: Fix reference leak in batadv_find_router
authorSven Eckelmann <sven@narfation.org>
Thu, 30 Jun 2016 18:11:34 +0000 (20:11 +0200)
committerSimon Wunderlich <sw@simonwunderlich.de>
Tue, 5 Jul 2016 10:43:52 +0000 (12:43 +0200)
commit15c2ed753cd9e3e746472deab8151337a5b6da56
treeb078f6d4b1f139c456e2643461dc24699a5b92b3
parent3db0decf1185357d6ab2256d0dede1ca9efda03d
batman-adv: Fix reference leak in batadv_find_router

The replacement of last_bonding_candidate in batadv_orig_node has to be an
atomic operation. Otherwise it is possible that the reference counter of a
batadv_orig_ifinfo is reduced which was no longer the
last_bonding_candidate when the new candidate is added. This can either
lead to an invalid memory access or to reference leaks which make it
impossible to an interface which was added to batman-adv.

Fixes: f3b3d9018975 ("batman-adv: add bonding again")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
net/batman-adv/routing.c
net/batman-adv/types.h