Skip to contentSkip to conversation

batman-adv: Add lockdep assert for container_list_lock

PATCH Applied Sven Eckelmann 2 participants 2 messages Dec 20, 2015 – Dec 29, 2015 Batman advanced

lore
Share & tools
lore

Sven Eckelmann

author maintainer
#0 lore raw

PATCH v2 1/1 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.

---
v2: remove this from the kref patchset and instead submit it as standalone patch

 net/batman-adv/main.c | 4 ++++
 1 file changed, 4 insertions(+)
net/batman-adv/main.c +4 -0
index 19ad0bb..c9b8205 100644
@@ -720,6 +720,8 @@ static struct batadv_tvlv_container
 {
 	struct batadv_tvlv_container *tvlv_tmp, *tvlv = NULL;
 
+	lockdep_assert_held(&bat_priv->tvlv.container_list_lock);
+
 	hlist_for_each_entry(tvlv_tmp, &bat_priv->tvlv.container_list, list) {
 		if (tvlv_tmp->tvlv_hdr.type != type)
 			continue;
@@ -752,6 +754,8 @@ static u16 batadv_tvlv_container_list_size(struct batadv_priv *bat_priv)
 	struct batadv_tvlv_container *tvlv;
 	u16 tvlv_len = 0;
 
+	lockdep_assert_held(&bat_priv->tvlv.container_list_lock);
+
 	hlist_for_each_entry(tvlv, &bat_priv->tvlv.container_list, list) {
 		tvlv_len += sizeof(struct batadv_tvlv_hdr);
 		tvlv_len += ntohs(tvlv->tvlv_hdr.len);
Signature · 1 line
2.6.4
#1 lore raw
Quoted 9 lines · On Sunday, December 20, 2015 09:04:03 Sven Eckelmann wrote:

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.

---
v2: remove this from the kref patchset and instead submit it as standalone patch net/batman-adv/main.c | 4 ++++

 1 file changed, 4 insertions(+)

Applied in revision 5f01697.

Thanks,
Marek