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

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


The following commit has been merged in the master branch:
commit b2262df7fcf2c395eca564df83238e931d88d7bf
Author: Simon Wunderlich <sw at simonwunderlich.de>
Date:   Sat Feb 8 16:45:06 2014 +0100

    batman-adv: fix potential orig_node reference leak
    
    Since batadv_orig_node_new() sets the refcount to two, assuming that
    the calling function will use a reference for putting the orig_node into
    a hash or similar, both references must be freed if initialization of
    the orig_node fails. Otherwise that object may be leaked in that error
    case.
    
    Reported-by: Antonio Quartulli <antonio at meshcoding.com>
    Signed-off-by: Simon Wunderlich <sw at simonwunderlich.de>
    Signed-off-by: Marek Lindner <mareklindner at neomailbox.ch>
    Signed-off-by: Antonio Quartulli <antonio at meshcoding.com>

diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 094ae7c..42cbc0a 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -254,6 +254,8 @@ batadv_iv_ogm_orig_get(struct batadv_priv *bat_priv, const uint8_t *addr)
 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);
 	batadv_orig_node_free_ref(orig_node);
 
 	return NULL;

-- 
LinuxNextTracking


More information about the linux-merge mailing list