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

batman at open-mesh.org batman at open-mesh.org
Thu Feb 20 00:22:57 CET 2014


The following commit has been merged in the master branch:
commit a5a5cb8cab526af2f6cbe9715f8ca843192f0d81
Author: Antonio Quartulli <antonio at meshcoding.com>
Date:   Sat Feb 15 02:17:20 2014 +0100

    batman-adv: avoid double free when orig_node initialization fails
    
    In the failure path of the orig_node initialization routine
    the orig_node->bat_iv.bcast_own field is free'd twice: first
    in batadv_iv_ogm_orig_get() and then later in
    batadv_orig_node_free_rcu().
    
    Fix it by removing the kfree in batadv_iv_ogm_orig_get().
    
    Signed-off-by: Antonio Quartulli <antonio at meshcoding.com>
    Signed-off-by: Marek Lindner <mareklindner at neomailbox.ch>

diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 42cbc0a..8323bce 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -241,18 +241,16 @@ batadv_iv_ogm_orig_get(struct batadv_priv *bat_priv, const uint8_t *addr)
 	size = bat_priv->num_ifaces * sizeof(uint8_t);
 	orig_node->bat_iv.bcast_own_sum = kzalloc(size, GFP_ATOMIC);
 	if (!orig_node->bat_iv.bcast_own_sum)
-		goto free_bcast_own;
+		goto free_orig_node;
 
 	hash_added = batadv_hash_add(bat_priv->orig_hash, batadv_compare_orig,
 				     batadv_choose_orig, orig_node,
 				     &orig_node->hash_entry);
 	if (hash_added != 0)
-		goto free_bcast_own;
+		goto free_orig_node;
 
 	return orig_node;
 
-free_bcast_own:
-	kfree(orig_node->bat_iv.bcast_own);
 free_orig_node:
 	/* free twice, as batadv_orig_node_new sets refcount to 2 */
 	batadv_orig_node_free_ref(orig_node);

-- 
LinuxNextTracking


More information about the linux-merge mailing list