diff options
author | Sven Eckelmann <sven@narfation.org> | 2016-12-27 02:51:17 -0500 |
---|---|---|
committer | Simon Wunderlich <sw@simonwunderlich.de> | 2017-01-04 02:22:04 -0500 |
commit | 4ea33ef0f9e95b69db9131d7afd98563713e81b0 (patch) | |
tree | f3d2e7bf47555b5c036ff54cc1b9fbd7445c36b3 | |
parent | 7ce7d89f48834cefece7804d38fc5d85382edf77 (diff) |
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: 8def0be82dd1 ("batman-adv: Consume skb in batadv_frag_send_packet")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
-rw-r--r-- | net/batman-adv/fragmentation.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c index 9c561e683f4b..0854ebd8613e 100644 --- a/net/batman-adv/fragmentation.c +++ b/net/batman-adv/fragmentation.c | |||
@@ -474,7 +474,7 @@ int batadv_frag_send_packet(struct sk_buff *skb, | |||
474 | primary_if = batadv_primary_if_get_selected(bat_priv); | 474 | primary_if = batadv_primary_if_get_selected(bat_priv); |
475 | if (!primary_if) { | 475 | if (!primary_if) { |
476 | ret = -EINVAL; | 476 | ret = -EINVAL; |
477 | goto put_primary_if; | 477 | goto free_skb; |
478 | } | 478 | } |
479 | 479 | ||
480 | /* Create one header to be copied to all fragments */ | 480 | /* Create one header to be copied to all fragments */ |
@@ -502,7 +502,7 @@ int batadv_frag_send_packet(struct sk_buff *skb, | |||
502 | skb_fragment = batadv_frag_create(skb, &frag_header, mtu); | 502 | skb_fragment = batadv_frag_create(skb, &frag_header, mtu); |
503 | if (!skb_fragment) { | 503 | if (!skb_fragment) { |
504 | ret = -ENOMEM; | 504 | ret = -ENOMEM; |
505 | goto free_skb; | 505 | goto put_primary_if; |
506 | } | 506 | } |
507 | 507 | ||
508 | batadv_inc_counter(bat_priv, BATADV_CNT_FRAG_TX); | 508 | batadv_inc_counter(bat_priv, BATADV_CNT_FRAG_TX); |
@@ -511,7 +511,7 @@ int batadv_frag_send_packet(struct sk_buff *skb, | |||
511 | ret = batadv_send_unicast_skb(skb_fragment, neigh_node); | 511 | ret = batadv_send_unicast_skb(skb_fragment, neigh_node); |
512 | if (ret != NET_XMIT_SUCCESS) { | 512 | if (ret != NET_XMIT_SUCCESS) { |
513 | ret = NET_XMIT_DROP; | 513 | ret = NET_XMIT_DROP; |
514 | goto free_skb; | 514 | goto put_primary_if; |
515 | } | 515 | } |
516 | 516 | ||
517 | frag_header.no++; | 517 | frag_header.no++; |
@@ -519,7 +519,7 @@ int batadv_frag_send_packet(struct sk_buff *skb, | |||
519 | /* The initial check in this function should cover this case */ | 519 | /* The initial check in this function should cover this case */ |
520 | if (frag_header.no == BATADV_FRAG_MAX_FRAGMENTS - 1) { | 520 | if (frag_header.no == BATADV_FRAG_MAX_FRAGMENTS - 1) { |
521 | ret = -EINVAL; | 521 | ret = -EINVAL; |
522 | goto free_skb; | 522 | goto put_primary_if; |
523 | } | 523 | } |
524 | } | 524 | } |
525 | 525 | ||
@@ -527,7 +527,7 @@ int batadv_frag_send_packet(struct sk_buff *skb, | |||
527 | if (batadv_skb_head_push(skb, header_size) < 0 || | 527 | if (batadv_skb_head_push(skb, header_size) < 0 || |
528 | pskb_expand_head(skb, header_size + ETH_HLEN, 0, GFP_ATOMIC) < 0) { | 528 | pskb_expand_head(skb, header_size + ETH_HLEN, 0, GFP_ATOMIC) < 0) { |
529 | ret = -ENOMEM; | 529 | ret = -ENOMEM; |
530 | goto free_skb; | 530 | goto put_primary_if; |
531 | } | 531 | } |
532 | 532 | ||
533 | memcpy(skb->data, &frag_header, header_size); | 533 | memcpy(skb->data, &frag_header, header_size); |