devlink: don't allow to change net namespace for FW_ACTIVATE reload action
Subsystems (3)
Jiri Pirko
maintainerPATCH v2 1/1 devlink: don't allow to change net namespace for FW_ACTIVATE reload action
From: Jiri Pirko <[email protected]>
The change on network namespace only makes sense during re-init reload action. For FW activation it is not applicable. So check if user passed an ATTR indicating network namespace change request and forbid it.
---
Sending to net-next as this is not actually fixing any real bug, it just adds a forgotten check.
---v1->v2:
- don't fail in case the user requests change to the current namespace
--- net/devlink/dev.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/devlink/dev.c +6 -0
@@ -476,6 +476,12 @@ int devlink_nl_cmd_reload(struct sk_buff *skb, struct genl_info *info) dest_net =devlink_netns_get (skb, info);if (IS_ERR (dest_net))return PTR_ERR (dest_net); +if (!net_eq (dest_net,devlink_net (devlink)) && + action !=DEVLINK_RELOAD_ACTION_DRIVER_REINIT ) { +NL_SET_ERR_MSG_MOD (info->extack, +"Changing namespace is only supported for reinit action" ); +return -EOPNOTSUPP ; + } } err =devlink_reload (devlink, dest_net, action, limit, &actions_performed, info->extack);
Signature · 1 line
2.39.0
Quoted 8 lines · On Mon, 13 Feb 2023 12:58:36 +0100 Jiri Pirko wrote:
From: Jiri Pirko <[email protected]>
The change on network namespace only makes sense during re-init reload action. For FW activation it is not applicable. So check if user passed an ATTR indicating network namespace change request and forbid it.
Fixes ccdf07219da6 ("devlink: Add reload action option to devlink reload command")Signed-off-by Jiri Pirko <[email protected]>
The fixes tag needs to go, too, in that case. Otherwise stable will likely suck it in. Which is riskier than putting it into an -rc. No need to repost tho, we can drop the tag when applying.
Jiri Pirko
maintainerQuoted 7 lines · Tue, Feb 14, 2023 at 07:13:11AM CET, [email protected] wrote:
Quoted 6 lines · On Mon, 13 Feb 2023 12:58:36 +0100 Jiri Pirko wrote:
From: Jiri Pirko <[email protected]>
The change on network namespace only makes sense during re-init reload action. For FW activation it is not applicable. So check if user passed an ATTR indicating network namespace change request and forbid it.
Quoted 6 lines
Quoted 2 lines
Fixes ccdf07219da6 ("devlink: Add reload action option to devlink reload command")Signed-off-by Jiri Pirko <[email protected]>The fixes tag needs to go, too, in that case. Otherwise stable will likely suck it in. Which is riskier than putting it into an -rc. No need to repost tho, we can drop the tag when applying.
Okay, up to you. Thanks!
Quoted 2 lines
Acked-by Jakub Kicinski <[email protected]>
This patch was applied to netdev/net-next.git (master) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (master) by Paolo Abeni <[email protected]>:
Quoted 10 lines · On Mon, 13 Feb 2023 12:58:36 +0100 you wrote:
From: Jiri Pirko <[email protected]>
The change on network namespace only makes sense during re-init reload action. For FW activation it is not applicable. So check if user passed an ATTR indicating network namespace change request and forbid it.
Fixes ccdf07219da6 ("devlink: Add reload action option to devlink reload command")Signed-off-by Jiri Pirko <[email protected]>[...]
Here is the summary with links:
- [net-next,v2] devlink: don't allow to change net namespace for FW_ACTIVATE reload action
https://git.kernel.org/netdev/net-next/c/2edd92570441
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Quoted 6 lines · Jiri Pirko
From: Jiri Pirko <[email protected]>
The change on network namespace only makes sense during re-init reload action. For FW activation it is not applicable. So check if user passed an ATTR indicating network namespace change request and forbid it.
Quoted 8 lines
Fixes ccdf07219da6 ("devlink: Add reload action option to devlink reload command")Signed-off-by Jiri Pirko <[email protected]>---
Sending to net-next as this is not actually fixing any real bug, it just adds a forgotten check.
---v1->v2:
- don't fail in case the user requests change to the current namespace
Thanks for fixing my feedback on v1 and sorry for not reviewing v2 earlier - I was taking a break last week.
For the record, and I know the patch has already been accepted, this looks good to me.