[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1473377861.18970.20.camel@edumazet-glaptop3.roam.corp.google.com>
Date: Thu, 08 Sep 2016 16:37:41 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Jojy Varghese <jojy.varghese@...il.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net
Subject: Re: [PATCH] net_namespace: fixed net_device reference leak
On Thu, 2016-09-08 at 16:16 -0700, Jojy Varghese wrote:
> The dst's do disappear but the net device does not. A better solution
> is to only hold reference to dst's net device ONLY if it is not a
> loopback device. In the case of the loopback device, we want to do
> only a "put" on it and skip the "hold".
>
> Updating the patch below:
>
> ---
> net/core/dst.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/net/core/dst.c b/net/core/dst.c
> index 7e45593..f63027e 100644
> --- a/net/core/dst.c
> +++ b/net/core/dst.c
> @@ -433,12 +433,11 @@ static void dst_ifdown(struct dst_entry *dst,
> struct net_device *dev,
> dst->input = dst_discard;
> dst->output = dst_discard_out;
> } else {
> - if (dst->dev == dev_net(dst->dev)->loopback_dev)
On which tree are you working exactly ?
Current code is not looking like that.
> - dst->dev = init_net.loopback_dev;
> - else
> + if (dst->dev != dev_net(dst->dev)->loopback_dev) {
> dst->dev = dev_net(dst->dev)->loopback_dev;
> + dev_hold(dst->dev);
> + }
>
> - dev_hold(dst->dev);
> dev_put(dev);
> }
> }
I appreciate your desperate efforts, but I am telling you the bug is
elsewhere.
Do you have a reproducer of the bug, on latest David Miller tree
( https://git.kernel.org/cgit/linux/kernel/git/davem/net.git )
Thanks.
Powered by blists - more mailing lists