The following commit has been merged in the merge/master branch: commit e017251099df603ec0857dfe306bed2434d7b487 Merge: 4610f5dab5690a4bb20809eddb0f210ca2e2a625 126c2f7a7c7d75ba85205d3c0756fd6ec0366c93 Author: Marek Lindner mareklindner@neomailbox.ch Date: Mon Jul 20 13:51:20 2015 +0800
Merge branch 'next'
diff --combined net/batman-adv/multicast.c index 25ed931,8bdd69f..d71c70e --- a/net/batman-adv/multicast.c +++ b/net/batman-adv/multicast.c @@@ -19,8 -19,6 +19,8 @@@ #include "main.h"
#include <linux/atomic.h> +#include <linux/bitops.h> +#include <linux/bug.h> #include <linux/byteorder/generic.h> #include <linux/errno.h> #include <linux/etherdevice.h> @@@ -31,7 -29,6 +31,7 @@@ #include <linux/ip.h> #include <linux/ipv6.h> #include <linux/list.h> +#include <linux/lockdep.h> #include <linux/netdevice.h> #include <linux/rculist.h> #include <linux/rcupdate.h> @@@ -90,7 -87,7 +90,7 @@@ static int batadv_mcast_mla_softif_get( * Returns true if the given address is already in the given list. * Otherwise returns false. */ -static bool batadv_mcast_mla_is_duplicate(uint8_t *mcast_addr, +static bool batadv_mcast_mla_is_duplicate(u8 *mcast_addr, struct hlist_head *mcast_list) { struct batadv_hw_addr *mcast_entry; @@@ -104,19 -101,15 +104,19 @@@
/** * batadv_mcast_mla_list_free - free a list of multicast addresses + * @bat_priv: the bat priv with all the soft interface information * @mcast_list: the list to free * * Removes and frees all items in the given mcast_list. */ -static void batadv_mcast_mla_list_free(struct hlist_head *mcast_list) +static void batadv_mcast_mla_list_free(struct batadv_priv *bat_priv, + struct hlist_head *mcast_list) { struct batadv_hw_addr *mcast_entry; struct hlist_node *tmp;
+ lockdep_assert_held(&bat_priv->tt.commit_lock); + hlist_for_each_entry_safe(mcast_entry, tmp, mcast_list, list) { hlist_del(&mcast_entry->list); kfree(mcast_entry); @@@ -139,8 -132,6 +139,8 @@@ static void batadv_mcast_mla_tt_retract struct batadv_hw_addr *mcast_entry; struct hlist_node *tmp;
+ lockdep_assert_held(&bat_priv->tt.commit_lock); + hlist_for_each_entry_safe(mcast_entry, tmp, &bat_priv->mcast.mla_list, list) { if (mcast_list && @@@ -171,8 -162,6 +171,8 @@@ static void batadv_mcast_mla_tt_add(str struct batadv_hw_addr *mcast_entry; struct hlist_node *tmp;
+ lockdep_assert_held(&bat_priv->tt.commit_lock); + if (!mcast_list) return;
@@@ -277,7 -266,7 +277,7 @@@ update batadv_mcast_mla_tt_add(bat_priv, &mcast_list);
out: - batadv_mcast_mla_list_free(&mcast_list); + batadv_mcast_mla_list_free(bat_priv, &mcast_list); }
/** @@@ -604,13 -593,11 +604,13 @@@ batadv_mcast_forw_mode(struct batadv_pr */ static void batadv_mcast_want_unsnoop_update(struct batadv_priv *bat_priv, struct batadv_orig_node *orig, - uint8_t mcast_flags) + u8 mcast_flags) { struct hlist_node *node = &orig->mcast_want_all_unsnoopables_node; struct hlist_head *head = &bat_priv->mcast.want_all_unsnoopables_list;
+ lockdep_assert_held(&orig->mcast_handler_lock); + /* switched from flag unset to set */ if (mcast_flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES && !(orig->mcast_flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES)) { @@@ -618,7 -605,7 +618,7 @@@
spin_lock_bh(&bat_priv->mcast.want_lists_lock); /* flag checks above + mcast_handler_lock prevents this */ - BUG_ON(!hlist_unhashed(node)); + WARN_ON(!hlist_unhashed(node));
hlist_add_head_rcu(node, head); spin_unlock_bh(&bat_priv->mcast.want_lists_lock); @@@ -629,7 -616,7 +629,7 @@@
spin_lock_bh(&bat_priv->mcast.want_lists_lock); /* flag checks above + mcast_handler_lock prevents this */ - BUG_ON(hlist_unhashed(node)); + WARN_ON(hlist_unhashed(node));
hlist_del_init_rcu(node); spin_unlock_bh(&bat_priv->mcast.want_lists_lock); @@@ -649,13 -636,11 +649,13 @@@ */ static void batadv_mcast_want_ipv4_update(struct batadv_priv *bat_priv, struct batadv_orig_node *orig, - uint8_t mcast_flags) + u8 mcast_flags) { struct hlist_node *node = &orig->mcast_want_all_ipv4_node; struct hlist_head *head = &bat_priv->mcast.want_all_ipv4_list;
+ lockdep_assert_held(&orig->mcast_handler_lock); + /* switched from flag unset to set */ if (mcast_flags & BATADV_MCAST_WANT_ALL_IPV4 && !(orig->mcast_flags & BATADV_MCAST_WANT_ALL_IPV4)) { @@@ -663,7 -648,7 +663,7 @@@
spin_lock_bh(&bat_priv->mcast.want_lists_lock); /* flag checks above + mcast_handler_lock prevents this */ - BUG_ON(!hlist_unhashed(node)); + WARN_ON(!hlist_unhashed(node));
hlist_add_head_rcu(node, head); spin_unlock_bh(&bat_priv->mcast.want_lists_lock); @@@ -674,7 -659,7 +674,7 @@@
spin_lock_bh(&bat_priv->mcast.want_lists_lock); /* flag checks above + mcast_handler_lock prevents this */ - BUG_ON(hlist_unhashed(node)); + WARN_ON(hlist_unhashed(node));
hlist_del_init_rcu(node); spin_unlock_bh(&bat_priv->mcast.want_lists_lock); @@@ -694,13 -679,11 +694,13 @@@ */ static void batadv_mcast_want_ipv6_update(struct batadv_priv *bat_priv, struct batadv_orig_node *orig, - uint8_t mcast_flags) + u8 mcast_flags) { struct hlist_node *node = &orig->mcast_want_all_ipv6_node; struct hlist_head *head = &bat_priv->mcast.want_all_ipv6_list;
+ lockdep_assert_held(&orig->mcast_handler_lock); + /* switched from flag unset to set */ if (mcast_flags & BATADV_MCAST_WANT_ALL_IPV6 && !(orig->mcast_flags & BATADV_MCAST_WANT_ALL_IPV6)) { @@@ -708,7 -691,7 +708,7 @@@
spin_lock_bh(&bat_priv->mcast.want_lists_lock); /* flag checks above + mcast_handler_lock prevents this */ - BUG_ON(!hlist_unhashed(node)); + WARN_ON(!hlist_unhashed(node));
hlist_add_head_rcu(node, head); spin_unlock_bh(&bat_priv->mcast.want_lists_lock); @@@ -719,7 -702,7 +719,7 @@@
spin_lock_bh(&bat_priv->mcast.want_lists_lock); /* flag checks above + mcast_handler_lock prevents this */ - BUG_ON(hlist_unhashed(node)); + WARN_ON(hlist_unhashed(node));
hlist_del_init_rcu(node); spin_unlock_bh(&bat_priv->mcast.want_lists_lock); @@@ -736,17 -719,17 +736,17 @@@ */ static void batadv_mcast_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv, struct batadv_orig_node *orig, - uint8_t flags, + u8 flags, void *tvlv_value, - uint16_t tvlv_value_len) + u16 tvlv_value_len) { bool orig_mcast_enabled = !(flags & BATADV_TVLV_HANDLER_OGM_CIFNOTFND); - uint8_t mcast_flags = BATADV_NO_FLAGS; + u8 mcast_flags = BATADV_NO_FLAGS; bool orig_initialized;
if (orig_mcast_enabled && tvlv_value && (tvlv_value_len >= sizeof(mcast_flags))) - mcast_flags = *(uint8_t *)tvlv_value; + mcast_flags = *(u8 *)tvlv_value;
spin_lock_bh(&orig->mcast_handler_lock); orig_initialized = test_bit(BATADV_ORIG_CAPA_HAS_MCAST,