[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CO1PR11MB5089AA5163E9748300AA0E97D6A09@CO1PR11MB5089.namprd11.prod.outlook.com>
Date: Thu, 16 Feb 2023 01:32:41 +0000
From: "Keller, Jacob E" <jacob.e.keller@...el.com>
To: Ido Schimmel <idosch@...dia.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC: "davem@...emloft.net" <davem@...emloft.net>,
"kuba@...nel.org" <kuba@...nel.org>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"jiri@...dia.com" <jiri@...dia.com>,
"sfr@...b.auug.org.au" <sfr@...b.auug.org.au>,
"mlxsw@...dia.com" <mlxsw@...dia.com>
Subject: RE: [PATCH net] devlink: Fix netdev notifier chain corruption
> -----Original Message-----
> From: Ido Schimmel <idosch@...dia.com>
> Sent: Tuesday, February 14, 2023 11:32 PM
> To: netdev@...r.kernel.org
> Cc: davem@...emloft.net; kuba@...nel.org; pabeni@...hat.com;
> edumazet@...gle.com; jiri@...dia.com; Keller, Jacob E
> <jacob.e.keller@...el.com>; sfr@...b.auug.org.au; mlxsw@...dia.com; Ido
> Schimmel <idosch@...dia.com>
> Subject: [PATCH net] devlink: Fix netdev notifier chain corruption
>
> Cited commit changed devlink to register its netdev notifier block on
> the global netdev notifier chain instead of on the per network namespace
> one.
>
> However, when changing the network namespace of the devlink instance,
> devlink still tries to unregister its notifier block from the chain of
> the old namespace and register it on the chain of the new namespace.
> This results in corruption of the notifier chains, as the same notifier
> block is registered on two different chains: The global one and the per
> network namespace one. In turn, this causes other problems such as the
> inability to dismantle namespaces due to netdev reference count issues.
>
> Fix by preventing devlink from moving its notifier block between
> namespaces.
>
> Reproducer:
>
> # echo "10 1" > /sys/bus/netdevsim/new_device
> # ip netns add test123
> # devlink dev reload netdevsim/netdevsim10 netns test123
> # ip netns del test123
> [ 71.935619] unregister_netdevice: waiting for lo to become free. Usage count =
> 2
> [ 71.938348] leaked reference.
>
> Fixes: 565b4824c39f ("devlink: change port event netdev notifier from per-net to
> global")
> Signed-off-by: Ido Schimmel <idosch@...dia.com>
> Reviewed-by: Jiri Pirko <jiri@...dia.com>
Reviewed-by: Jacob Keller <jacob.e.keller@...el.com>
Powered by blists - more mailing lists