Skip to contentSkip to conversation

ipv6/ip6_gre: fix error case handling in ip6gre_tunnel_xmit()

PATCH Applied Tommi Rantala 3 participants 3 messages Feb 6, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipv6/ip6_gre: fix error case handling in ip6gre_tunnel_xmit()

ip6gre_tunnel_xmit() is leaking the skb when we hit this error branch, and the -1 return value from this function is bogus. Use the error handling we already have in place in ip6gre_tunnel_xmit() for this error case to fix this.

---
 net/ipv6/ip6_gre.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/ip6_gre.c +1 -1
index c727e47..131dd09 100644
@@ -960,7 +960,7 @@ static netdev_tx_t ip6gre_tunnel_xmit(struct sk_buff *skb,
 	int ret;
 
 	if (!ip6_tnl_xmit_ctl(t))
-		return -1;
+		goto tx_err;
 
 	switch (skb->protocol) {
 	case htons(ETH_P_IP):
Signature · 1 line
1.8.1
Acked-by on v1 1/1
#1 lore raw
Quoted 15 lines · Tommi Rantala

ip6gre_tunnel_xmit() is leaking the skb when we hit this error branch, and the -1 return value from this function is bogus. Use the error handling we already have in place in ip6gre_tunnel_xmit() for this error case to fix this.

---
 net/ipv6/ip6_gre.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/ip6_gre.c +0 -0
index c727e47..131dd09 100644

net/ipv6/ip6_gre.c static netdev_tx_t ip6gre_tunnel_xmit(struct sk_buff *skb, · line 966

Quoted 8 lines
net/ipv6/ip6_gre.c +1 -1
@@ -960,7 +960,7 @@ static netdev_tx_t ip6gre_tunnel_xmit(struct sk_buff *skb,
 	int ret;
 
 	if (!ip6_tnl_xmit_ctl(t))
-		return -1;
+		goto tx_err;
 
 	switch (skb->protocol) {
 	case htons(ETH_P_IP):

Thanks Tommi

maintainer Applied
#2 lore raw

From: Eric Dumazet <[email protected]>
Date: Wed, 06 Feb 2013 05:29:55 -0800

Quoted 18 lines · Tommi Rantala
Quoted 17 lines

ip6gre_tunnel_xmit() is leaking the skb when we hit this error branch, and the -1 return value from this function is bogus. Use the error handling we already have in place in ip6gre_tunnel_xmit() for this error case to fix this.

---
 net/ipv6/ip6_gre.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/ip6_gre.c +0 -0
index c727e47..131dd09 100644
@@ -960,7 +960,7 @@ static netdev_tx_t ip6gre_tunnel_xmit(struct sk_buff *skb,
 	int ret;
 
Quoted 8 lines

net/ipv6/ip6_gre.c static netdev_tx_t ip6gre_tunnel_xmit(struct sk_buff *skb, · line 966

Quoted 6 lines
net/ipv6/ip6_gre.c +1 -1
 	if (!ip6_tnl_xmit_ctl(t))
-		return -1;
+		goto tx_err;
 
 	switch (skb->protocol) {
 	case htons(ETH_P_IP):

Applied, thanks everyone.