Repository : ssh://git@open-mesh.org/batman-adv
On branch : master
commit 17093459a996f7d5c98f10c10d6d84766bce5a15 Author: Sven Eckelmann sven@narfation.org Date: Sat Jan 28 10:12:39 2017 +0100
batman-adv: Fix double call of dev_queue_xmit
The net_xmit_eval has side effects because it is not making sure that e isn't evaluated twice.
#define net_xmit_eval(e) ((e) == NET_XMIT_CN ? 0 : (e))
The code requested by David Miller [1]
return net_xmit_eval(dev_queue_xmit(skb));
will get transformed into
return ((dev_queue_xmit(skb)) == NET_XMIT_CN ? 0 : (dev_queue_xmit(skb)))
dev_queue_xmit will therefore be tried again (with an already consumed skb) whenever the return code is not NET_XMIT_CN.
[1] https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2017-January/016836.html
Fixes: 17efab9867c5 ("batman-adv: Simplify handling of NET_XMIT_CN") Signed-off-by: Sven Eckelmann sven@narfation.org
17093459a996f7d5c98f10c10d6d84766bce5a15 net/batman-adv/send.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c index d9b2889..1489ec2 100644 --- a/net/batman-adv/send.c +++ b/net/batman-adv/send.c @@ -77,6 +77,7 @@ int batadv_send_skb_packet(struct sk_buff *skb, { struct batadv_priv *bat_priv; struct ethhdr *ethhdr; + int ret;
bat_priv = netdev_priv(hard_iface->soft_iface);
@@ -115,7 +116,8 @@ int batadv_send_skb_packet(struct sk_buff *skb, * congestion and traffic shaping, it drops and returns NET_XMIT_DROP * (which is > 0). This will not be treated as an error. */ - return net_xmit_eval(dev_queue_xmit(skb)); + ret = dev_queue_xmit(skb); + return net_xmit_eval(ret); send_skb_err: kfree_skb(skb); return NET_XMIT_DROP;