]> git.baikalelectronics.ru Git - kernel.git/commit
batman-adv: Check hard_iface refcnt before calling function
authorSven Eckelmann <sven@narfation.org>
Sat, 5 Mar 2016 15:09:16 +0000 (16:09 +0100)
committerAntonio Quartulli <a@unstable.cc>
Tue, 10 May 2016 10:28:29 +0000 (18:28 +0800)
commit46ac58e42e848b6d37006d021de4ce4d286b97f7
tree60e001876ccef11a01760fd9eb4539ce93979021
parentb2e0d38dcf63971c2101c7b136e0d99f9048fc5c
batman-adv: Check hard_iface refcnt before calling function

The batadv_hardif_list list is checked in many situations and the items
in this list are given to specialized functions to modify the routing
behavior. At the moment each of these called functions has to check
itself whether the received batadv_hard_iface has a refcount > 0 before
it can increase the reference counter and use it in other objects.

This can easily lead to problems because it is not easily visible where
all callers of a function got the batadv_hard_iface object from and
whether they already hold a valid reference.

Checking the reference counter directly before calling a subfunction
with a pointer from the batadv_hardif_list avoids this problem.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
net/batman-adv/bat_iv_ogm.c
net/batman-adv/bat_v_ogm.c
net/batman-adv/originator.c
net/batman-adv/send.c