]> www.infradead.org Git - users/jedix/linux-maple.git/commit
batman-adv: Fix potential synchronization issues in mcast tvlv handler
authorLinus Lüssing <linus.luessing@c0d3.blue>
Tue, 16 Jun 2015 15:10:26 +0000 (17:10 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Oct 2015 21:43:24 +0000 (14:43 -0700)
commit3e6263c022b2c377bf883c99e278eb8bbe207325
tree1fbc08ce3681ae1f3c2796daa308877bfce19823
parent8dbeac75e6c679b87a6b50f0fc05c31cec1ed58c
batman-adv: Fix potential synchronization issues in mcast tvlv handler

commit 8a4023c5b5e30b11f1f383186f4a7222b3b823cf upstream.

So far the mcast tvlv handler did not anticipate the processing of
multiple incoming OGMs from the same originator at the same time. This
can lead to various issues:

* Broken refcounting: For instance two mcast handlers might both assume
  that an originator just got multicast capabilities and will together
  wrongly decrease mcast.num_disabled by two, potentially leading to
  an integer underflow.

* Potential kernel panic on hlist_del_rcu(): Two mcast handlers might
  one after another try to do an
  hlist_del_rcu(&orig->mcast_want_all_*_node). The second one will
  cause memory corruption / crashes.
  (Reported by: Sven Eckelmann <sven@narfation.org>)

Right in the beginning the code path makes assumptions about the current
multicast related state of an originator and bases all updates on that. The
easiest and least error prune way to fix the issues in this case is to
serialize multiple mcast handler invocations with a spinlock.

Fixes: 60432d756cf0 ("batman-adv: Announce new capability via multicast TVLV")
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/batman-adv/multicast.c
net/batman-adv/originator.c
net/batman-adv/types.h