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