batman-adv: 2014.0.0 updated stability fixes
[feed/routing.git] / batman-adv / patches / 0009-batman-adv-fix-potential-orig_node-reference-leak.patch
1 From cb4d66e6803b854663ee758e3eecbda183b0b007 Mon Sep 17 00:00:00 2001
2 From: Simon Wunderlich <sw@simonwunderlich.de>
3 Date: Sat, 8 Feb 2014 16:45:06 +0100
4 Subject: [PATCH 09/13] batman-adv: fix potential orig_node reference leak
5
6 Since batadv_orig_node_new() sets the refcount to two, assuming that
7 the calling function will use a reference for putting the orig_node into
8 a hash or similar, both references must be freed if initialization of
9 the orig_node fails. Otherwise that object may be leaked in that error
10 case.
11
12 Reported-by: Antonio Quartulli <antonio@meshcoding.com>
13 Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
14 Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
15 ---
16 bat_iv_ogm.c | 2 ++
17 1 file changed, 2 insertions(+)
18
19 diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
20 index 6f4fcdc..c07e59f 100644
21 --- a/bat_iv_ogm.c
22 +++ b/bat_iv_ogm.c
23 @@ -256,6 +256,8 @@ batadv_iv_ogm_orig_get(struct batadv_priv *bat_priv, const uint8_t *addr)
24 free_bcast_own:
25 kfree(orig_node->bat_iv.bcast_own);
26 free_orig_node:
27 + /* free twice, as batadv_orig_node_new sets refcount to 2 */
28 + batadv_orig_node_free_ref(orig_node);
29 batadv_orig_node_free_ref(orig_node);
30
31 return NULL;
32 --
33 1.9.0.rc3
34