diff mbox

ipv6: release dst properly in ipip6_tunnel_xmit

Message ID 1387531212-17034-1-git-send-email-roy.qing.li@gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Li RongQing Dec. 20, 2013, 9:20 a.m. UTC
From: Li RongQing <roy.qing.li@gmail.com>

if a dst is not attached to anywhere, it should be released before
exit ipip6_tunnel_xmit, otherwise cause dst memory leakage.

Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
---
 net/ipv6/sit.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Eric Dumazet Dec. 20, 2013, 2:16 p.m. UTC | #1
On Fri, 2013-12-20 at 17:20 +0800, roy.qing.li@gmail.com wrote:
> From: Li RongQing <roy.qing.li@gmail.com>
> 
> if a dst is not attached to anywhere, it should be released before
> exit ipip6_tunnel_xmit, otherwise cause dst memory leakage.
> 
> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
> ---
>  net/ipv6/sit.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
> index 366fbba..d68a224 100644
> --- a/net/ipv6/sit.c
> +++ b/net/ipv6/sit.c
> @@ -966,8 +966,10 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
>  	tos = INET_ECN_encapsulate(tos, ipv6_get_dsfield(iph6));
>  
>  	skb = iptunnel_handle_offloads(skb, false, SKB_GSO_SIT);
> -	if (IS_ERR(skb))
> +	if (IS_ERR(skb)) {
> +		ip_rt_put(rt);
>  		goto out;
> +	}
>  
>  	err = iptunnel_xmit(rt, skb, fl4.saddr, fl4.daddr, IPPROTO_IPV6, tos,
>  			    ttl, df, !net_eq(tunnel->net, dev_net(dev)));


Fixes: 61c1db7fae21 ("ipv6: sit: add GSO/TSO support")
Acked-by: Eric Dumazet <edumazet@google.com>

Thanks a lot !


--
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 Dec. 27, 2013, 6:16 p.m. UTC | #2
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 20 Dec 2013 06:16:46 -0800

> On Fri, 2013-12-20 at 17:20 +0800, roy.qing.li@gmail.com wrote:
>> From: Li RongQing <roy.qing.li@gmail.com>
>> 
>> if a dst is not attached to anywhere, it should be released before
>> exit ipip6_tunnel_xmit, otherwise cause dst memory leakage.
>> 
>> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
...
> Fixes: 61c1db7fae21 ("ipv6: sit: add GSO/TSO support")
> 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/sit.c b/net/ipv6/sit.c
index 366fbba..d68a224 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -966,8 +966,10 @@  static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
 	tos = INET_ECN_encapsulate(tos, ipv6_get_dsfield(iph6));
 
 	skb = iptunnel_handle_offloads(skb, false, SKB_GSO_SIT);
-	if (IS_ERR(skb))
+	if (IS_ERR(skb)) {
+		ip_rt_put(rt);
 		goto out;
+	}
 
 	err = iptunnel_xmit(rt, skb, fl4.saddr, fl4.daddr, IPPROTO_IPV6, tos,
 			    ttl, df, !net_eq(tunnel->net, dev_net(dev)));