diff mbox

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

Message ID 1360157042-16473-1-git-send-email-tt.rantala@gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Tommi Rantala Feb. 6, 2013, 1:24 p.m. UTC
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.

Signed-off-by: Tommi Rantala <tt.rantala@gmail.com>
---
 net/ipv6/ip6_gre.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eric Dumazet Feb. 6, 2013, 1:29 p.m. UTC | #1
On Wed, 2013-02-06 at 15:24 +0200, Tommi Rantala wrote:
> 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.
> 
> Signed-off-by: Tommi Rantala <tt.rantala@gmail.com>
> ---
>  net/ipv6/ip6_gre.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
> index c727e47..131dd09 100644
> --- a/net/ipv6/ip6_gre.c
> +++ b/net/ipv6/ip6_gre.c
> @@ -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):

Acked-by: Eric Dumazet <edumazet@google.com>

Thanks Tommi


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Feb. 6, 2013, 9:02 p.m. UTC | #2
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 06 Feb 2013 05:29:55 -0800

> On Wed, 2013-02-06 at 15:24 +0200, Tommi Rantala wrote:
>> 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.
>> 
>> Signed-off-by: Tommi Rantala <tt.rantala@gmail.com>
>> ---
>>  net/ipv6/ip6_gre.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
>> index c727e47..131dd09 100644
>> --- a/net/ipv6/ip6_gre.c
>> +++ b/net/ipv6/ip6_gre.c
>> @@ -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):
> 
> Acked-by: Eric Dumazet <edumazet@google.com>

Applied, thanks everyone.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index c727e47..131dd09 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -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):