[v2,1/2] batman-adv: Fix broadcast/ogm queue limit on a removed interface

Message ID 1366236516-14512-1-git-send-email-linus.luessing@web.de (mailing list archive)
State Superseded, archived
Delegated to: Marek Lindner
Headers

Commit Message

Linus Lüssing April 17, 2013, 10:08 p.m. UTC
  When removing a single interface while a broadcast or ogm packet is
still pending then we will free the forward packet without releasing the
queue slots again.

This patch is supposed to fix this issue.

Signed-off-by: Linus Lüssing <linus.luessing@web.de>
---
 send.c |    6 ++++++
 1 file changed, 6 insertions(+)


* v2: Fix summary line of commit message: This issue can happen for both
      OGMs and broadcast packets.
  

Comments

Sven Eckelmann March 10, 2016, 5:44 p.m. UTC | #1
On Thursday 18 April 2013 00:08:36 Linus Lüssing wrote:
> When removing a single interface while a broadcast or ogm packet is
> still pending then we will free the forward packet without releasing the
> queue slots again.
> 
> This patch is supposed to fix this issue.
> 
> Signed-off-by: Linus Lüssing <linus.luessing@web.de>
> ---

You are talking a batman-adv interface when it contains multiple slave
interfaces, right? So batadv_purge_outstanding_packets would be called in
batadv_hardif_disable_interface and not in batadv_mesh_free (which is only 
done when the batX interface will be removed).

This at least sounds legit and I cannot find where else this imbalance would 
be fixed.

Acked-by: Sven Eckelmann <sven@narfation.org>

Kind regards,
	Sven

PS: This patch only requires the path change from / to /net/batman-adv/ to 
apply via git-am
  

Patch

diff --git a/send.c b/send.c
index ed7072a..2d539d6 100644
--- a/send.c
+++ b/send.c
@@ -356,6 +356,9 @@  batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,
 
 		if (pending) {
 			hlist_del(&forw_packet->list);
+			if (!forw_packet->own)
+				atomic_inc(&bat_priv->bcast_queue_left);
+
 			batadv_forw_packet_free(forw_packet);
 		}
 	}
@@ -382,6 +385,9 @@  batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,
 
 		if (pending) {
 			hlist_del(&forw_packet->list);
+			if (!forw_packet->own)
+				atomic_inc(&bat_priv->batman_queue_left);
+
 			batadv_forw_packet_free(forw_packet);
 		}
 	}