[linux-next] LinuxNextTracking branch, master, updated. next-20160824

batman at open-mesh.org batman at open-mesh.org
Thu Aug 25 00:15:42 CEST 2016

The following commit has been merged in the master branch:
commit 15d5ffdea0ddfa78609b1587851b13d9137fbbcd
Author: Sven Eckelmann <sven at narfation.org>
Date:   Fri Jul 15 17:39:23 2016 +0200

    batman-adv: Place kref_get for tt_common near use
    It is hard to understand why the refcnt is increased when it isn't done
    near the actual place the new reference is used. So using kref_get right
    before the place which requires the reference and in the same function
    helps to avoid accidental problems caused by incorrect reference counting.
    Signed-off-by: Sven Eckelmann <sven at narfation.org>
    Signed-off-by: Marek Lindner <mareklindner at neomailbox.ch>
    Signed-off-by: Simon Wunderlich <sw at simonwunderlich.de>

diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 094da1a..d94e298 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -1645,13 +1645,13 @@ static bool batadv_tt_global_add(struct batadv_priv *bat_priv,
 		if (flags & BATADV_TT_CLIENT_ROAM)
 			tt_global_entry->roam_at = jiffies;
-		kref_get(&common->refcount);
 		common->added_at = jiffies;
 		atomic_set(&tt_global_entry->orig_list_count, 0);
+		kref_get(&common->refcount);
 		hash_added = batadv_hash_add(bat_priv->tt.global_hash,
 					     batadv_choose_tt, common,


More information about the linux-merge mailing list