batman-adv: Refresh patches
[feed/routing.git] / batman-adv / patches / 0002-batman-adv-Decrease-hardif-refcnt-on-fragmentation-s.patch
1 From: Sven Eckelmann <sven@narfation.org>
2 Date: Tue, 27 Dec 2016 08:51:17 +0100
3 Subject: batman-adv: Decrease hardif refcnt on fragmentation send error
4
5 An error before the hardif is found has to free the skb. But every error
6 after that has to free the skb + put the hard interface.
7
8 Fixes: 8b4132b1447a ("batman-adv: Consume skb in batadv_frag_send_packet")
9 Signed-off-by: Sven Eckelmann <sven@narfation.org>
10 Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
11
12 Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/205dc8385dc863467f4f6ccec2e63254e6baf831
13
14 diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c
15 index 9c561e683f4b8b68642b626b51a0dcda30260e97..0854ebd8613e9bf9044b04099b11341325d6e194 100644
16 --- a/net/batman-adv/fragmentation.c
17 +++ b/net/batman-adv/fragmentation.c
18 @@ -474,7 +474,7 @@ int batadv_frag_send_packet(struct sk_buff *skb,
19 primary_if = batadv_primary_if_get_selected(bat_priv);
20 if (!primary_if) {
21 ret = -EINVAL;
22 - goto put_primary_if;
23 + goto free_skb;
24 }
25
26 /* Create one header to be copied to all fragments */
27 @@ -502,7 +502,7 @@ int batadv_frag_send_packet(struct sk_buff *skb,
28 skb_fragment = batadv_frag_create(skb, &frag_header, mtu);
29 if (!skb_fragment) {
30 ret = -ENOMEM;
31 - goto free_skb;
32 + goto put_primary_if;
33 }
34
35 batadv_inc_counter(bat_priv, BATADV_CNT_FRAG_TX);
36 @@ -511,7 +511,7 @@ int batadv_frag_send_packet(struct sk_buff *skb,
37 ret = batadv_send_unicast_skb(skb_fragment, neigh_node);
38 if (ret != NET_XMIT_SUCCESS) {
39 ret = NET_XMIT_DROP;
40 - goto free_skb;
41 + goto put_primary_if;
42 }
43
44 frag_header.no++;
45 @@ -519,7 +519,7 @@ int batadv_frag_send_packet(struct sk_buff *skb,
46 /* The initial check in this function should cover this case */
47 if (frag_header.no == BATADV_FRAG_MAX_FRAGMENTS - 1) {
48 ret = -EINVAL;
49 - goto free_skb;
50 + goto put_primary_if;
51 }
52 }
53
54 @@ -527,7 +527,7 @@ int batadv_frag_send_packet(struct sk_buff *skb,
55 if (batadv_skb_head_push(skb, header_size) < 0 ||
56 pskb_expand_head(skb, header_size + ETH_HLEN, 0, GFP_ATOMIC) < 0) {
57 ret = -ENOMEM;
58 - goto free_skb;
59 + goto put_primary_if;
60 }
61
62 memcpy(skb->data, &frag_header, header_size);