Skip to content

Commit

Permalink
net: devlink: move netdev notifier block to dest namespace during reload
Browse files Browse the repository at this point in the history
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 <idosch@idosch.org>
Fixes: 02a68a4 ("net: devlink: track netdev with devlink_port assigned")
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Tested-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jiri Pirko authored and kuba-moo committed Nov 9, 2022
1 parent 3e52fba commit 15feb56
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/core/devlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 15feb56

Please sign in to comment.