The following commit has been merged in the merge/master branch: commit 6355683d1c5ef25c15bc136fa85e52e8de05e964 Merge: b42df0b92d8773f80564751f7fbdbce824ea1290 d5bbce8465af90351295903da8327101409401aa Author: Sven Eckelmann sven@narfation.org Date: Sat May 14 23:49:17 2011 +0200
Merge remote-tracking branch 'origin/standalone/next' into merge/master
Conflicts: net/batman-adv/compat.c
diff --combined net/batman-adv/aggregation.c index 9b94590,a8c3203..a8c3203 --- a/net/batman-adv/aggregation.c +++ b/net/batman-adv/aggregation.c @@@ -23,6 -23,7 +23,7 @@@ #include "aggregation.h" #include "send.h" #include "routing.h" + #include "hard-interface.h"
/* calculate the size of the tt information for a given packet */ static int tt_len(struct batman_packet *batman_packet) @@@ -105,12 -106,15 +106,15 @@@ static void new_aggregated_packet(unsig struct forw_packet *forw_packet_aggr; unsigned char *skb_buff;
+ if (!atomic_inc_not_zero(&if_incoming->refcount)) + return; + /* own packet should always be scheduled */ if (!own_packet) { if (!atomic_dec_not_zero(&bat_priv->batman_queue_left)) { bat_dbg(DBG_BATMAN, bat_priv, "batman packet queue full\n"); - return; + goto out; } }
@@@ -118,7 -122,7 +122,7 @@@ if (!forw_packet_aggr) { if (!own_packet) atomic_inc(&bat_priv->batman_queue_left); - return; + goto out; }
if ((atomic_read(&bat_priv->aggregated_ogms)) && @@@ -133,7 -137,7 +137,7 @@@ if (!own_packet) atomic_inc(&bat_priv->batman_queue_left); kfree(forw_packet_aggr); - return; + goto out; } skb_reserve(forw_packet_aggr->skb, sizeof(struct ethhdr));
@@@ -164,6 -168,10 +168,10 @@@ queue_delayed_work(bat_event_workqueue, &forw_packet_aggr->delayed_work, send_time - jiffies); + + return; + out: + hardif_free_ref(if_incoming); }
/* aggregate a new packet into the existing aggregation */ diff --combined net/batman-adv/send.c index f30d0c6,76daa46..76daa46 --- a/net/batman-adv/send.c +++ b/net/batman-adv/send.c @@@ -377,6 -377,8 +377,8 @@@ static void forw_packet_free(struct for { if (forw_packet->skb) kfree_skb(forw_packet->skb); + if (forw_packet->if_incoming) + hardif_free_ref(forw_packet->if_incoming); kfree(forw_packet); }
@@@ -539,6 -541,7 +541,7 @@@ void purge_outstanding_packets(struct b { struct forw_packet *forw_packet; struct hlist_node *tmp_node, *safe_tmp_node; + bool pending;
if (hard_iface) bat_dbg(DBG_BATMAN, bat_priv, @@@ -567,8 -570,13 +570,13 @@@ * send_outstanding_bcast_packet() will lock the list to * delete the item from the list */ - cancel_delayed_work_sync(&forw_packet->delayed_work); + pending = cancel_delayed_work_sync(&forw_packet->delayed_work); spin_lock_bh(&bat_priv->forw_bcast_list_lock); + + if (pending) { + hlist_del(&forw_packet->list); + forw_packet_free(forw_packet); + } } spin_unlock_bh(&bat_priv->forw_bcast_list_lock);
@@@ -591,8 -599,13 +599,13 @@@ * send_outstanding_bat_packet() will lock the list to * delete the item from the list */ - cancel_delayed_work_sync(&forw_packet->delayed_work); + pending = cancel_delayed_work_sync(&forw_packet->delayed_work); spin_lock_bh(&bat_priv->forw_bat_list_lock); + + if (pending) { + hlist_del(&forw_packet->list); + forw_packet_free(forw_packet); + } } spin_unlock_bh(&bat_priv->forw_bat_list_lock); }