hnetd: add global config file
[feed/routing.git] / batman-adv / patches / 0008-batman-adv-fix-reference-counting-imbalance-while-se.patch
1 From 113f264b60bc4f50011a8f736d74f91ff7da11f1 Mon Sep 17 00:00:00 2001
2 From: Antonio Quartulli <antonio@open-mesh.com>
3 Date: Wed, 23 Apr 2014 14:05:16 +0200
4 Subject: [PATCH 8/9] batman-adv: fix reference counting imbalance while
5 sending fragment
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 In the new fragmentation code the batadv_frag_send_packet()
11 function obtains a reference to the primary_if, but it does
12 not release it upon return.
13
14 This reference imbalance prevents the primary_if (and then
15 the related netdevice) to be properly released on shut down.
16
17 Fix this by releasing the primary_if in batadv_frag_send_packet().
18
19 Introduced by db56e4ecf5c2b179a0101138eacc2ec52b6ef45d
20 ("batman-adv: Fragment and send skbs larger than mtu")
21
22 Cc: Martin Hundebøll <martin@hundeboll.net>
23 Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
24 Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
25 Acked-by: Martin Hundebøll <martin@hundeboll.net>
26 ---
27 fragmentation.c | 11 ++++++++---
28 1 file changed, 8 insertions(+), 3 deletions(-)
29
30 diff --git a/fragmentation.c b/fragmentation.c
31 index 88df9b1..cc1cfd6 100644
32 --- a/fragmentation.c
33 +++ b/fragmentation.c
34 @@ -418,12 +418,13 @@ bool batadv_frag_send_packet(struct sk_buff *skb,
35 struct batadv_neigh_node *neigh_node)
36 {
37 struct batadv_priv *bat_priv;
38 - struct batadv_hard_iface *primary_if;
39 + struct batadv_hard_iface *primary_if = NULL;
40 struct batadv_frag_packet frag_header;
41 struct sk_buff *skb_fragment;
42 unsigned mtu = neigh_node->if_incoming->net_dev->mtu;
43 unsigned header_size = sizeof(frag_header);
44 unsigned max_fragment_size, max_packet_size;
45 + bool ret = false;
46
47 /* To avoid merge and refragmentation at next-hops we never send
48 * fragments larger than BATADV_FRAG_MAX_FRAG_SIZE
49 @@ -483,7 +484,11 @@ bool batadv_frag_send_packet(struct sk_buff *skb,
50 skb->len + ETH_HLEN);
51 batadv_send_skb_packet(skb, neigh_node->if_incoming, neigh_node->addr);
52
53 - return true;
54 + ret = true;
55 +
56 out_err:
57 - return false;
58 + if (primary_if)
59 + batadv_hardif_free_ref(primary_if);
60 +
61 + return ret;
62 }
63 --
64 2.0.0.rc2
65