Commit 4ea33ef0 authored by Sven Eckelmann's avatar Sven Eckelmann Committed by Simon Wunderlich

batman-adv: Decrease hardif refcnt on fragmentation send error

An error before the hardif is found has to free the skb. But every error
after that has to free the skb + put the hard interface.

Fixes: 8def0be8 ("batman-adv: Consume skb in batadv_frag_send_packet")
Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
Signed-off-by: default avatarSimon Wunderlich <sw@simonwunderlich.de>
parent 7ce7d89f
...@@ -474,7 +474,7 @@ int batadv_frag_send_packet(struct sk_buff *skb, ...@@ -474,7 +474,7 @@ int batadv_frag_send_packet(struct sk_buff *skb,
primary_if = batadv_primary_if_get_selected(bat_priv); primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if) { if (!primary_if) {
ret = -EINVAL; ret = -EINVAL;
goto put_primary_if; goto free_skb;
} }
/* Create one header to be copied to all fragments */ /* Create one header to be copied to all fragments */
...@@ -502,7 +502,7 @@ int batadv_frag_send_packet(struct sk_buff *skb, ...@@ -502,7 +502,7 @@ int batadv_frag_send_packet(struct sk_buff *skb,
skb_fragment = batadv_frag_create(skb, &frag_header, mtu); skb_fragment = batadv_frag_create(skb, &frag_header, mtu);
if (!skb_fragment) { if (!skb_fragment) {
ret = -ENOMEM; ret = -ENOMEM;
goto free_skb; goto put_primary_if;
} }
batadv_inc_counter(bat_priv, BATADV_CNT_FRAG_TX); batadv_inc_counter(bat_priv, BATADV_CNT_FRAG_TX);
...@@ -511,7 +511,7 @@ int batadv_frag_send_packet(struct sk_buff *skb, ...@@ -511,7 +511,7 @@ int batadv_frag_send_packet(struct sk_buff *skb,
ret = batadv_send_unicast_skb(skb_fragment, neigh_node); ret = batadv_send_unicast_skb(skb_fragment, neigh_node);
if (ret != NET_XMIT_SUCCESS) { if (ret != NET_XMIT_SUCCESS) {
ret = NET_XMIT_DROP; ret = NET_XMIT_DROP;
goto free_skb; goto put_primary_if;
} }
frag_header.no++; frag_header.no++;
...@@ -519,7 +519,7 @@ int batadv_frag_send_packet(struct sk_buff *skb, ...@@ -519,7 +519,7 @@ int batadv_frag_send_packet(struct sk_buff *skb,
/* The initial check in this function should cover this case */ /* The initial check in this function should cover this case */
if (frag_header.no == BATADV_FRAG_MAX_FRAGMENTS - 1) { if (frag_header.no == BATADV_FRAG_MAX_FRAGMENTS - 1) {
ret = -EINVAL; ret = -EINVAL;
goto free_skb; goto put_primary_if;
} }
} }
...@@ -527,7 +527,7 @@ int batadv_frag_send_packet(struct sk_buff *skb, ...@@ -527,7 +527,7 @@ int batadv_frag_send_packet(struct sk_buff *skb,
if (batadv_skb_head_push(skb, header_size) < 0 || if (batadv_skb_head_push(skb, header_size) < 0 ||
pskb_expand_head(skb, header_size + ETH_HLEN, 0, GFP_ATOMIC) < 0) { pskb_expand_head(skb, header_size + ETH_HLEN, 0, GFP_ATOMIC) < 0) {
ret = -ENOMEM; ret = -ENOMEM;
goto free_skb; goto put_primary_if;
} }
memcpy(skb->data, &frag_header, header_size); memcpy(skb->data, &frag_header, header_size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment