All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] ip6_gre: fix a dst leak in ip6erspan_tunnel_xmit
@ 2019-09-13  9:45 Xin Long
  2019-09-14 15:12 ` William Tu
  2019-09-16  7:09 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Xin Long @ 2019-09-13  9:45 UTC (permalink / raw)
  To: network dev; +Cc: davem, William Tu

In ip6erspan_tunnel_xmit(), if the skb will not be sent out, it has to
be freed on the tx_err path. Otherwise when deleting a netns, it would
cause dst/dev to leak, and dmesg shows:

  unregister_netdevice: waiting for lo to become free. Usage count = 1

Fixes: ef7baf5e083c ("ip6_gre: add ip6 erspan collect_md mode")
Signed-off-by: Xin Long <lucien.xin@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 dd2d0b96..d5779d6 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -968,7 +968,7 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,
 		if (unlikely(!tun_info ||
 			     !(tun_info->mode & IP_TUNNEL_INFO_TX) ||
 			     ip_tunnel_info_af(tun_info) != AF_INET6))
-			return -EINVAL;
+			goto tx_err;
 
 		key = &tun_info->key;
 		memset(&fl6, 0, sizeof(fl6));
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] ip6_gre: fix a dst leak in ip6erspan_tunnel_xmit
  2019-09-13  9:45 [PATCH net] ip6_gre: fix a dst leak in ip6erspan_tunnel_xmit Xin Long
@ 2019-09-14 15:12 ` William Tu
  2019-09-16  7:09 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: William Tu @ 2019-09-14 15:12 UTC (permalink / raw)
  To: Xin Long; +Cc: network dev, David Miller

On Fri, Sep 13, 2019 at 2:45 AM Xin Long <lucien.xin@gmail.com> wrote:
>
> In ip6erspan_tunnel_xmit(), if the skb will not be sent out, it has to
> be freed on the tx_err path. Otherwise when deleting a netns, it would
> cause dst/dev to leak, and dmesg shows:
>
>   unregister_netdevice: waiting for lo to become free. Usage count = 1
>
> Fixes: ef7baf5e083c ("ip6_gre: add ip6 erspan collect_md mode")
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> ---

LGTM, thanks for the fix!
Acked-by: William Tu <u9012063@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 dd2d0b96..d5779d6 100644
> --- a/net/ipv6/ip6_gre.c
> +++ b/net/ipv6/ip6_gre.c
> @@ -968,7 +968,7 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,
>                 if (unlikely(!tun_info ||
>                              !(tun_info->mode & IP_TUNNEL_INFO_TX) ||
>                              ip_tunnel_info_af(tun_info) != AF_INET6))
> -                       return -EINVAL;
> +                       goto tx_err;
>
>                 key = &tun_info->key;
>                 memset(&fl6, 0, sizeof(fl6));
> --
> 2.1.0
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] ip6_gre: fix a dst leak in ip6erspan_tunnel_xmit
  2019-09-13  9:45 [PATCH net] ip6_gre: fix a dst leak in ip6erspan_tunnel_xmit Xin Long
  2019-09-14 15:12 ` William Tu
@ 2019-09-16  7:09 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-09-16  7:09 UTC (permalink / raw)
  To: lucien.xin; +Cc: netdev, u9012063

From: Xin Long <lucien.xin@gmail.com>
Date: Fri, 13 Sep 2019 17:45:47 +0800

> In ip6erspan_tunnel_xmit(), if the skb will not be sent out, it has to
> be freed on the tx_err path. Otherwise when deleting a netns, it would
> cause dst/dev to leak, and dmesg shows:
> 
>   unregister_netdevice: waiting for lo to become free. Usage count = 1
> 
> Fixes: ef7baf5e083c ("ip6_gre: add ip6 erspan collect_md mode")
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

Applied and queued up for -stable.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-16  7:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-13  9:45 [PATCH net] ip6_gre: fix a dst leak in ip6erspan_tunnel_xmit Xin Long
2019-09-14 15:12 ` William Tu
2019-09-16  7:09 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.