]> git.baikalelectronics.ru Git - kernel.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)
committerJakub Kicinski <kuba@kernel.org>
Thu, 26 Nov 2020 01:26:34 +0000 (17:26 -0800)
commit3032e55dcb3a9f7f1b5ea6d044a493dc7a2cfe5e
tree1198ba7ba2156a4d6b10983528c356344cbaf12f
parent41b8ab3cbc178dbc791b8da805a09d2ec2f7ff2a
devlink: Hold rtnl lock while reading netdev attributes

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: 8cbebb478e5e ("Introduce devlink infrastructure")
Signed-off-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/devlink.c