netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net/ipv6: stop leaking percpu memory in fib6 info
@ 2018-10-08 12:06 Mike Rapoport
  2018-10-08 17:46 ` David Miller
  2018-10-08 18:15 ` David Ahern
  0 siblings, 2 replies; 4+ messages in thread
From: Mike Rapoport @ 2018-10-08 12:06 UTC (permalink / raw)
  To: David S. Miller; +Cc: David Ahern, netdev, Mike Rapoport, stable

The fib6_info_alloc() function allocates percpu memory to hold per CPU
pointers to rt6_info, but this memory is never freed. Fix it.

Fixes: a64efe142f5e ("net/ipv6: introduce fib6_info struct and helpers")

Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Cc: stable@vger.kernel.org
---
 net/ipv6/ip6_fib.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index cf709eadc932..cc7de7eb8b9c 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -194,6 +194,8 @@ void fib6_info_destroy_rcu(struct rcu_head *head)
 				*ppcpu_rt = NULL;
 			}
 		}
+
+		free_percpu(f6i->rt6i_pcpu);
 	}
 
 	lwtstate_put(f6i->fib6_nh.nh_lwtstate);
-- 
2.7.4

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

* Re: [PATCH net-next] net/ipv6: stop leaking percpu memory in fib6 info
  2018-10-08 12:06 [PATCH net-next] net/ipv6: stop leaking percpu memory in fib6 info Mike Rapoport
@ 2018-10-08 17:46 ` David Miller
  2018-10-08 18:15 ` David Ahern
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2018-10-08 17:46 UTC (permalink / raw)
  To: rppt; +Cc: dsahern, netdev, stable

From: Mike Rapoport <rppt@linux.vnet.ibm.com>
Date: Mon,  8 Oct 2018 15:06:03 +0300

> The fib6_info_alloc() function allocates percpu memory to hold per CPU
> pointers to rt6_info, but this memory is never freed. Fix it.
> 
> Fixes: a64efe142f5e ("net/ipv6: introduce fib6_info struct and helpers")
> 

Please do not put empty lines between Fixes: and other tags.  They
belong together as a group.

> Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
> Cc: stable@vger.kernel.org

Several problems here.

You cannot submit patches to net-next and expect them to go onward to
-stable.  That is not appropriate.  If it is going to stable, you
must target 'net' not 'net-next'.

Furthermore, for networking changes, explicit CC: of stable is not
appropriate.  Instead you must explicitly ask me to queue the patch
up for -stable as I handle networking stable submissions myself.

Thank you.

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

* Re: [PATCH net-next] net/ipv6: stop leaking percpu memory in fib6 info
  2018-10-08 12:06 [PATCH net-next] net/ipv6: stop leaking percpu memory in fib6 info Mike Rapoport
  2018-10-08 17:46 ` David Miller
@ 2018-10-08 18:15 ` David Ahern
  2018-10-09  4:03   ` Mike Rapoport
  1 sibling, 1 reply; 4+ messages in thread
From: David Ahern @ 2018-10-08 18:15 UTC (permalink / raw)
  To: Mike Rapoport, David S. Miller; +Cc: netdev, stable

On 10/8/18 6:06 AM, Mike Rapoport wrote:
> The fib6_info_alloc() function allocates percpu memory to hold per CPU
> pointers to rt6_info, but this memory is never freed. Fix it.
> 
> Fixes: a64efe142f5e ("net/ipv6: introduce fib6_info struct and helpers")
> 
> Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
> Cc: stable@vger.kernel.org
> ---
>  net/ipv6/ip6_fib.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
> index cf709eadc932..cc7de7eb8b9c 100644
> --- a/net/ipv6/ip6_fib.c
> +++ b/net/ipv6/ip6_fib.c
> @@ -194,6 +194,8 @@ void fib6_info_destroy_rcu(struct rcu_head *head)
>  				*ppcpu_rt = NULL;
>  			}
>  		}
> +
> +		free_percpu(f6i->rt6i_pcpu);
>  	}
>  
>  	lwtstate_put(f6i->fib6_nh.nh_lwtstate);
> 

Odd that KMEMLEAK is not detecting this. Thanks for the fix.

Reviewed-by: David Ahern <dsahern@gmail.com>

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

* Re: [PATCH net-next] net/ipv6: stop leaking percpu memory in fib6 info
  2018-10-08 18:15 ` David Ahern
@ 2018-10-09  4:03   ` Mike Rapoport
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Rapoport @ 2018-10-09  4:03 UTC (permalink / raw)
  To: David Ahern; +Cc: David S. Miller, netdev, stable

On Mon, Oct 08, 2018 at 12:15:54PM -0600, David Ahern wrote:
> On 10/8/18 6:06 AM, Mike Rapoport wrote:
> > The fib6_info_alloc() function allocates percpu memory to hold per CPU
> > pointers to rt6_info, but this memory is never freed. Fix it.
> > 
> > Fixes: a64efe142f5e ("net/ipv6: introduce fib6_info struct and helpers")
> > 
> > Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
> > Cc: stable@vger.kernel.org
> > ---
> >  net/ipv6/ip6_fib.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
> > index cf709eadc932..cc7de7eb8b9c 100644
> > --- a/net/ipv6/ip6_fib.c
> > +++ b/net/ipv6/ip6_fib.c
> > @@ -194,6 +194,8 @@ void fib6_info_destroy_rcu(struct rcu_head *head)
> >  				*ppcpu_rt = NULL;
> >  			}
> >  		}
> > +
> > +		free_percpu(f6i->rt6i_pcpu);
> >  	}
> >  
> >  	lwtstate_put(f6i->fib6_nh.nh_lwtstate);
> > 
> 
> Odd that KMEMLEAK is not detecting this. Thanks for the fix.

There's a comment in kmemleak that says:

	/*
	 * Percpu allocations are only scanned and not reported as leaks
	 * (min_count is set to 0).
	 */

No idea why, though...
 
> Reviewed-by: David Ahern <dsahern@gmail.com>
> 

-- 
Sincerely yours,
Mike.

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

end of thread, other threads:[~2018-10-09  4:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-08 12:06 [PATCH net-next] net/ipv6: stop leaking percpu memory in fib6 info Mike Rapoport
2018-10-08 17:46 ` David Miller
2018-10-08 18:15 ` David Ahern
2018-10-09  4:03   ` Mike Rapoport

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).