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
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
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.
14 This reference imbalance prevents the primary_if (and then
15 the related netdevice) to be properly released on shut down.
17 Fix this by releasing the primary_if in batadv_frag_send_packet().
19 Introduced by db56e4ecf5c2b179a0101138eacc2ec52b6ef45d
20 ("batman-adv: Fragment and send skbs larger than mtu")
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>
27 fragmentation.c | 11 ++++++++---
28 1 file changed, 8 insertions(+), 3 deletions(-)
30 diff --git a/fragmentation.c b/fragmentation.c
31 index 88df9b1..cc1cfd6 100644
34 @@ -418,12 +418,13 @@ bool batadv_frag_send_packet(struct sk_buff *skb,
35 struct batadv_neigh_node *neigh_node)
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;
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,
51 batadv_send_skb_packet(skb, neigh_node->if_incoming, neigh_node->addr);
59 + batadv_hardif_free_ref(primary_if);