Skip to contentSkip to conversation

vxlan: release rt when found circular route

PATCH Superseded Fan Du 3 participants 5 messages Dec 5, 2013 – Dec 11, 2013

Subsystems (2)
lore
Share & tools
lore

Fan Du

author
#0 lore raw

PATCH 1/1 vxlan: release rt when found circular route

Otherwise causing dst memory leakage.
Have Checked all other type tunnel device transmit implementation, no such things happens anymore.

---
 drivers/net/vxlan.c |    1 +
 1 file changed, 1 insertion(+)
drivers/net/vxlan.c +1 -0
index 78df8f3..97b4340 100644
@@ -1665,6 +1665,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 		}
 
 		if (rt->dst.dev == dev) {
+			ip_rt_put(rt);
 			netdev_dbg(dev, "circular route to %pI4\n",
 				   &dst->sin.sin_addr.s_addr);
 			dev->stats.collisions++;
Signature · 1 line
1.7.9.5
maintainer
#2 lore raw
In reply to Fan Du

From: Fan Du <[email protected]>
Date: Thu, 5 Dec 2013 16:03:51 +0800

Quoted 5 lines

Otherwise causing dst memory leakage.
Have Checked all other type tunnel device transmit implementation, no such things happens anymore.

...

drivers/net/vxlan.c static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, · line 1671

Quoted 8 lines
drivers/net/vxlan.c +1 -0
@@ -1665,6 +1665,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 		}
 
 		if (rt->dst.dev == dev) {
+			ip_rt_put(rt);
 			netdev_dbg(dev, "circular route to %pI4\n",
 				   &dst->sin.sin_addr.s_addr);
 			dev->stats.collisions++;

There is already a "rt_tx_error" label that will handle releasing the 'rt', so at the end of this basic block, goto rt_tx_error instead of just plain tx_error.

Thanks.

author
#3 lore raw

PATCH v2 1/1 vxlan: release rt when found circular route

Quoted 12 lines · David Miller

From: Fan Du<[email protected]>
Date: Thu, 5 Dec 2013 16:03:51 +0800

Quoted 5 lines

Otherwise causing dst memory leakage.
Have Checked all other type tunnel device transmit implementation, no such things happens anymore.

...

Quoted 3 lines
(quoted diff) +0 -0
@@ -1665,6 +1665,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
  		}
 
Quoted 9 lines

Review static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, · line 1671

Quoted 5 lines
(quoted diff) +1 -0
  		if (rt->dst.dev == dev) {
+			ip_rt_put(rt);
  			netdev_dbg(dev, "circular route to %pI4\n",
  				&dst->sin.sin_addr.s_addr);
  			dev->stats.collisions++;

There is already a "rt_tx_error" label that will handle releasing the 'rt', so at the end of this basic block, goto rt_tx_error instead of just plain tx_error.

My first thought is using rt_tx_error indeed :), but second thought is this might criticized by being ugly. Anyway please review.

From 8867cb9783511a1c945a087209484f74de912689 Mon Sep 17 00:00:00 2001
From: Fan Du <[email protected]>
Date: Mon, 9 Dec 2013 10:33:53 +0800
Subject: [PATCHv2 net] vxlan: release rt when found circular route

Otherwise causing dst memory leakage.
Have Checked all other type tunnel device transmit implementation, no such things happens anymore.

---
v2: use rt_tx_error label to release rt.

---
 drivers/net/vxlan.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/vxlan.c +1 -1
index 0358c07..249e01c 100644
@@ -1668,7 +1668,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 			netdev_dbg(dev, "circular route to %pI4\n",
 				   &dst->sin.sin_addr.s_addr);
 			dev->stats.collisions++;
-			goto tx_error;
+			goto rt_tx_error;
 		}
 
 		/* Bypass encapsulation if the destination is local */
Signature · 7 lines
1.7.9.5


-- 
浮沉随浪只记今朝笑

--fan
maintainer
#4 lore raw

From: Fan Du <[email protected]>
Date: Mon, 9 Dec 2013 14:27:55 +0800

Quoted 4 lines

From: Fan Du <[email protected]>
Date: Mon, 9 Dec 2013 10:33:53 +0800
Subject: [PATCHv2 net] vxlan: release rt when found circular route

Quoted 8 lines

Otherwise causing dst memory leakage.
Have Checked all other type tunnel device transmit implementation, no such things happens anymore.

---
v2: use rt_tx_error label to release rt.

Applied and queued up for -stable, thanks.