[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpU21rUQ9JWb8qzTs=V+bGC1TZ1HaWC-t1GkUqu5Ymdoxw@mail.gmail.com>
Date: Sat, 8 Jul 2017 11:44:14 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: David Miller <davem@...emloft.net>
Cc: Nicolas Dichtel <nicolas.dichtel@...nd.com>,
Linux Kernel Network Developers <netdev@...r.kernel.org>,
Hongjun Li <hongjun.li@...nd.com>
Subject: Re: [PATCH net] ip[6]: don't register inet[6]dev when dev is down
On Sat, Jul 8, 2017 at 3:02 AM, David Miller <davem@...emloft.net> wrote:
> From: Nicolas Dichtel <nicolas.dichtel@...nd.com>
> Date: Wed, 5 Jul 2017 17:57:25 +0200
>
>> From: Hongjun Li <hongjun.li@...nd.com>
>>
>> When the netdev event NETDEV_CHANGEMTU is triggered, the inet[6]dev may be
>> created even if the corresponding device is down. This may lead to a leak
>> in the procfs when the device is unregistered, and finally trigger a
>> backtrace:
> ...
>> When a device changes from one netns to another, it's first unregistered,
>> then the netns reference is updated and the dev is registered in the new
>> netns. Thus, when a slave moves to another netns, it is first
>> unregistered. This triggers a NETDEV_UNREGISTER event which is caught by
>> the bonding driver. The driver calls bond_release(), which calls
>> dev_set_mtu() and thus triggers NETDEV_CHANGEMTU (the device is still in
>> the old netns).
>>
>> Signed-off-by: Hongjun Li <hongjun.li@...nd.com>
>> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@...nd.com>
>
> I'm still not convinced about this.
>
> We have lots of code which iterates ipv6 idevs, and then has a
> check for IFF_UP.
>
> So having an idev attached to a down interface is not a bug nor
> illegal.
>
> In fact, addrconf_cleanup() walks all of the init_net idevs and
> calls addrconf_ifdown() with how=1 regardless of IFF_UP or not.
>
> This entire area is quite a mess.
+1. I fixed a nasty bug with how=1 for loopback before...
>
> Can you show exactly why the procfs state isn't cleaned up for
> these devices moving between namespaces? Maybe that is the real
> bug and a better place to fix this.
>
It is because the ipv6_add_dev() adds these proc files back after
NETDEV_UNREGISTER event.
Powered by blists - more mailing lists