batman-adv: Check hard_iface refcnt when receiving skb
authorSven Eckelmann <sven@narfation.org>
Sat, 5 Mar 2016 15:09:17 +0000 (16:09 +0100)
committerAntonio Quartulli <a@unstable.cc>
Tue, 10 May 2016 10:28:29 +0000 (18:28 +0800)
commit4fe56e60ac1be4d103f64743d0a36fd31a70657c
tree655b231a0971e2b1a39404af5e37b9b9577e12e3
parent273534468f050744b32054f84a1e20ee6b5bd329
batman-adv: Check hard_iface refcnt when receiving skb

The receive function may start processing an incoming packet while the
hard_iface is shut down in a different context. All called functions called
with the batadv_hard_iface object belonging to the incoming interface would
have to check whether the reference counter is still > 0.

This is rather error-prone because this check can be forgotten easily.
Instead check the reference counter when receiving the object to make sure
that all called functions have a valid reference.

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/main.c