aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2016-06-27 02:15:42 -0400
committerSimon Wunderlich <sw@simonwunderlich.de>2016-08-09 01:54:33 -0400
commitf19dc7770f5d55274ef9821392199daca03469a9 (patch)
tree3057a28549d424cf4f455634547bc2db48ad7ae4 /net/batman-adv
parent86452f81d200d4d6ad489ef84311030eff84dd84 (diff)
batman-adv: Remove orig_node reference handling from send_skb_unicast
The function batadv_send_skb_unicast is not acquiring a reference for an orig_node nor removing it from any datastructure. It still reduces the reference counter for an object which is still in the hands of the caller. This is confusing and can lead in the future to problems in the reference handling of the caller function. Signed-off-by: Sven Eckelmann <sven@narfation.org> Acked-by: Linus Lüssing <linus.luessing@c0d3.blue> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Diffstat (limited to 'net/batman-adv')
-rw-r--r--net/batman-adv/send.c25
-rw-r--r--net/batman-adv/soft-interface.c3
2 files changed, 20 insertions, 8 deletions
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index 33d8bd14140c..8d4e1f578574 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -315,8 +315,7 @@ out:
315 * 315 *
316 * Wrap the given skb into a batman-adv unicast or unicast-4addr header 316 * Wrap the given skb into a batman-adv unicast or unicast-4addr header
317 * depending on whether BATADV_UNICAST or BATADV_UNICAST_4ADDR was supplied 317 * depending on whether BATADV_UNICAST or BATADV_UNICAST_4ADDR was supplied
318 * as packet_type. Then send this frame to the given orig_node and release a 318 * as packet_type. Then send this frame to the given orig_node.
319 * reference to this orig_node.
320 * 319 *
321 * Return: NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise. 320 * Return: NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise.
322 */ 321 */
@@ -370,8 +369,6 @@ int batadv_send_skb_unicast(struct batadv_priv *bat_priv,
370 ret = NET_XMIT_SUCCESS; 369 ret = NET_XMIT_SUCCESS;
371 370
372out: 371out:
373 if (orig_node)
374 batadv_orig_node_put(orig_node);
375 if (ret == NET_XMIT_DROP) 372 if (ret == NET_XMIT_DROP)
376 kfree_skb(skb); 373 kfree_skb(skb);
377 return ret; 374 return ret;
@@ -403,6 +400,7 @@ int batadv_send_skb_via_tt_generic(struct batadv_priv *bat_priv,
403 struct ethhdr *ethhdr = (struct ethhdr *)skb->data; 400 struct ethhdr *ethhdr = (struct ethhdr *)skb->data;
404 struct batadv_orig_node *orig_node; 401 struct batadv_orig_node *orig_node;
405 u8 *src, *dst; 402 u8 *src, *dst;
403 int ret;
406 404
407 src = ethhdr->h_source; 405 src = ethhdr->h_source;
408 dst = ethhdr->h_dest; 406 dst = ethhdr->h_dest;
@@ -414,8 +412,13 @@ int batadv_send_skb_via_tt_generic(struct batadv_priv *bat_priv,
414 } 412 }
415 orig_node = batadv_transtable_search(bat_priv, src, dst, vid); 413 orig_node = batadv_transtable_search(bat_priv, src, dst, vid);
416 414
417 return batadv_send_skb_unicast(bat_priv, skb, packet_type, 415 ret = batadv_send_skb_unicast(bat_priv, skb, packet_type,
418 packet_subtype, orig_node, vid); 416 packet_subtype, orig_node, vid);
417
418 if (orig_node)
419 batadv_orig_node_put(orig_node);
420
421 return ret;
419} 422}
420 423
421/** 424/**
@@ -433,10 +436,16 @@ int batadv_send_skb_via_gw(struct batadv_priv *bat_priv, struct sk_buff *skb,
433 unsigned short vid) 436 unsigned short vid)
434{ 437{
435 struct batadv_orig_node *orig_node; 438 struct batadv_orig_node *orig_node;
439 int ret;
436 440
437 orig_node = batadv_gw_get_selected_orig(bat_priv); 441 orig_node = batadv_gw_get_selected_orig(bat_priv);
438 return batadv_send_skb_unicast(bat_priv, skb, BATADV_UNICAST_4ADDR, 442 ret = batadv_send_skb_unicast(bat_priv, skb, BATADV_UNICAST_4ADDR,
439 BATADV_P_DATA, orig_node, vid); 443 BATADV_P_DATA, orig_node, vid);
444
445 if (orig_node)
446 batadv_orig_node_put(orig_node);
447
448 return ret;
440} 449}
441 450
442/** 451/**
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 216ac03ab432..e508bf5957b3 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -57,6 +57,7 @@
57#include "hard-interface.h" 57#include "hard-interface.h"
58#include "multicast.h" 58#include "multicast.h"
59#include "network-coding.h" 59#include "network-coding.h"
60#include "originator.h"
60#include "packet.h" 61#include "packet.h"
61#include "send.h" 62#include "send.h"
62#include "sysfs.h" 63#include "sysfs.h"
@@ -377,6 +378,8 @@ dropped:
377dropped_freed: 378dropped_freed:
378 batadv_inc_counter(bat_priv, BATADV_CNT_TX_DROPPED); 379 batadv_inc_counter(bat_priv, BATADV_CNT_TX_DROPPED);
379end: 380end:
381 if (mcast_single_orig)
382 batadv_orig_node_put(mcast_single_orig);
380 if (primary_if) 383 if (primary_if)
381 batadv_hardif_put(primary_if); 384 batadv_hardif_put(primary_if);
382 return NETDEV_TX_OK; 385 return NETDEV_TX_OK;