aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Pirko <[email protected]>2022-11-08 14:22:07 +0100
committerJakub Kicinski <[email protected]>2022-11-09 13:45:59 -0800
commit15feb56e30efea95992f5c572cee753db205eb7b (patch)
tree7b135eb065d73822fdccb40ee9af123e8c3e75d1
parent3e52fba03a20234abc65a656cef063a1045d9723 (diff)
net: devlink: move netdev notifier block to dest namespace during reload
The notifier block tracking netdev changes in devlink is registered during devlink_alloc() per-net, it is then unregistered in devlink_free(). When devlink moves from net namespace to another one, the notifier block needs to move along. Fix this by adding forgotten call to move the block. Reported-by: Ido Schimmel <[email protected]> Fixes: 02a68a47eade ("net: devlink: track netdev with devlink_port assigned") Reviewed-by: Ido Schimmel <[email protected]> Tested-by: Ido Schimmel <[email protected]> Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
-rw-r--r--net/core/devlink.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 40fcdded57e6..ea0b319385fc 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -4502,8 +4502,11 @@ static int devlink_reload(struct devlink *devlink, struct net *dest_net,
if (err)
return err;
- if (dest_net && !net_eq(dest_net, curr_net))
+ if (dest_net && !net_eq(dest_net, curr_net)) {
+ move_netdevice_notifier_net(curr_net, dest_net,
+ &devlink->netdevice_nb);
write_pnet(&devlink->_net, dest_net);
+ }
err = devlink->ops->reload_up(devlink, action, limit, actions_performed, extack);
devlink_reload_failed_set(devlink, !!err);