]> git.itanic.dy.fi Git - linux-stable/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)
commitb187c9b4178b87954dbc94e78a7094715794714f
tree1198ba7ba2156a4d6b10983528c356344cbaf12f
parent3cb2e6d92be637b79d6ba0746d610a8dfcc0400b
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: bfcd3a466172 ("Introduce devlink infrastructure")
Signed-off-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/devlink.c