Skip to content

Commit c9dad80

Browse files
ecsvordex
authored andcommitted
batman-adv: Use kref_get for batadv_tvlv_container_get
batadv_tvlv_container_get requires that tvlv.container_list_lock is held by the caller. It is therefore not possible that an item in tvlv.container_list has an reference counter of 0 and is still in the list The kref_get function instead WARNs (with debug information) when the reference counter would still be 0. This makes a bug in batman-adv better visible because kref_get_unless_zero would have ignored this problem. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Antonio Quartulli <a@unstable.cc>
1 parent d7d6de9 commit c9dad80

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

‎net/batman-adv/main.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -748,9 +748,7 @@ batadv_tvlv_container_get(struct batadv_priv *bat_priv, u8 type, u8 version)
748748
if (tvlv_tmp->tvlv_hdr.version != version)
749749
continue;
750750

751-
if (!kref_get_unless_zero(&tvlv_tmp->refcount))
752-
continue;
753-
751+
kref_get(&tvlv_tmp->refcount);
754752
tvlv = tvlv_tmp;
755753
break;
756754
}

0 commit comments

Comments
 (0)