aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv
diff options
context:
space:
mode:
authorSimon Wunderlich <sw@simonwunderlich.de>2014-02-08 10:45:06 -0500
committerAntonio Quartulli <antonio@meshcoding.com>2014-02-17 11:17:01 -0500
commitb2262df7fcf2c395eca564df83238e931d88d7bf (patch)
treeb4d4923237b668091ff9d6b459f575d087c4e7d3 /net/batman-adv
parent08bf0ed29c7ded45c477d08618220dd200c3524a (diff)
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@meshcoding.com> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Diffstat (limited to 'net/batman-adv')
-rw-r--r--net/batman-adv/bat_iv_ogm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 094ae7ca50a0..42cbc0a68941 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)
254free_bcast_own: 254free_bcast_own:
255 kfree(orig_node->bat_iv.bcast_own); 255 kfree(orig_node->bat_iv.bcast_own);
256free_orig_node: 256free_orig_node:
257 /* free twice, as batadv_orig_node_new sets refcount to 2 */
258 batadv_orig_node_free_ref(orig_node);
257 batadv_orig_node_free_ref(orig_node); 259 batadv_orig_node_free_ref(orig_node);
258 260
259 return NULL; 261 return NULL;