Commit dded0692247c76f892adee3ba6878ff5f394e210

Authored by Sven Eckelmann
Committed by Antonio Quartulli
1 parent 81f0268350

batman-adv: Add lockdep assert for container_list_lock

The batadv_tvlv_container* functions state in their kernel-doc that they
require tvlv.container_list_lock. Add an assert to automatically detect
when this might have been ignored by the caller.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <a@unstable.cc>

Showing 1 changed file with 4 additions and 0 deletions Side-by-side Diff

net/batman-adv/main.c
... ... @@ -697,6 +697,8 @@
697 697 {
698 698 struct batadv_tvlv_container *tvlv_tmp, *tvlv = NULL;
699 699  
  700 + lockdep_assert_held(&bat_priv->tvlv.container_list_lock);
  701 +
700 702 hlist_for_each_entry(tvlv_tmp, &bat_priv->tvlv.container_list, list) {
701 703 if (tvlv_tmp->tvlv_hdr.type != type)
702 704 continue;
... ... @@ -728,6 +730,8 @@
728 730 {
729 731 struct batadv_tvlv_container *tvlv;
730 732 u16 tvlv_len = 0;
  733 +
  734 + lockdep_assert_held(&bat_priv->tvlv.container_list_lock);
731 735  
732 736 hlist_for_each_entry(tvlv, &bat_priv->tvlv.container_list, list) {
733 737 tvlv_len += sizeof(struct batadv_tvlv_hdr);