]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
devlink: Hold rtnl lock while reading netdev attributes
authorParav Pandit <parav@nvidia.com>
Wed, 25 Nov 2020 09:16:19 +0000 (11:16 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Dec 2020 09:41:59 +0000 (10:41 +0100)
commit9670490edfc442d0287726a28ec7dd5f2cab0969
tree7aa75b5120b4b76e3777c4dc1e0c62082e4758d1
parent89bb11da843beec4a6004ef7ecfa44b83a68b56c
devlink: Hold rtnl lock while reading netdev attributes

[ Upstream commit b187c9b4178b87954dbc94e78a7094715794714f ]

A netdevice of a devlink port can be moved to different net namespace
than its parent devlink instance.
This scenario occurs when devlink reload is not used.

When netdevice is undergoing migration to net namespace, its ifindex
and name may change.

In such use case, devlink port query may read stale netdev attributes.

Fix it by reading them under rtnl lock.

Fixes: bfcd3a466172 ("Introduce devlink infrastructure")
Signed-off-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/core/devlink.c