All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch net-next v2] devlink: don't allow to change net namespace for FW_ACTIVATE reload action
@ 2023-02-13 11:58 Jiri Pirko
  2023-02-14  6:13 ` Jakub Kicinski
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jiri Pirko @ 2023-02-13 11:58 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, pabeni, edumazet, jacob.e.keller, moshe, simon.horman

From: Jiri Pirko <jiri@nvidia.com>

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 <jiri@nvidia.com>
---
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(+)

diff --git a/net/devlink/dev.c b/net/devlink/dev.c
index ab4e0f3c4e3d..b40153fa2680 100644
--- a/net/devlink/dev.c
+++ b/net/devlink/dev.c
@@ -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);
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [patch net-next v2] devlink: don't allow to change net namespace for FW_ACTIVATE reload action
  2023-02-13 11:58 [patch net-next v2] devlink: don't allow to change net namespace for FW_ACTIVATE reload action Jiri Pirko
@ 2023-02-14  6:13 ` Jakub Kicinski
  2023-02-14  7:31   ` Jiri Pirko
  2023-02-14 14:30 ` patchwork-bot+netdevbpf
  2023-02-20  9:01 ` Simon Horman
  2 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2023-02-14  6:13 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, pabeni, edumazet, jacob.e.keller, moshe, simon.horman

On Mon, 13 Feb 2023 12:58:36 +0100 Jiri Pirko wrote:
> From: Jiri Pirko <jiri@nvidia.com>
> 
> 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 <jiri@nvidia.com>

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.

Acked-by: Jakub Kicinski <kuba@kernel.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch net-next v2] devlink: don't allow to change net namespace for FW_ACTIVATE reload action
  2023-02-14  6:13 ` Jakub Kicinski
@ 2023-02-14  7:31   ` Jiri Pirko
  0 siblings, 0 replies; 5+ messages in thread
From: Jiri Pirko @ 2023-02-14  7:31 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: netdev, davem, pabeni, edumazet, jacob.e.keller, moshe, simon.horman

Tue, Feb 14, 2023 at 07:13:11AM CET, kuba@kernel.org wrote:
>On Mon, 13 Feb 2023 12:58:36 +0100 Jiri Pirko wrote:
>> From: Jiri Pirko <jiri@nvidia.com>
>> 
>> 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 <jiri@nvidia.com>
>
>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!

>
>Acked-by: Jakub Kicinski <kuba@kernel.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch net-next v2] devlink: don't allow to change net namespace for FW_ACTIVATE reload action
  2023-02-13 11:58 [patch net-next v2] devlink: don't allow to change net namespace for FW_ACTIVATE reload action Jiri Pirko
  2023-02-14  6:13 ` Jakub Kicinski
@ 2023-02-14 14:30 ` patchwork-bot+netdevbpf
  2023-02-20  9:01 ` Simon Horman
  2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-02-14 14:30 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, kuba, pabeni, edumazet, jacob.e.keller, moshe,
	simon.horman

Hello:

This patch was applied to netdev/net-next.git (master)
by Paolo Abeni <pabeni@redhat.com>:

On Mon, 13 Feb 2023 12:58:36 +0100 you wrote:
> From: Jiri Pirko <jiri@nvidia.com>
> 
> 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 <jiri@nvidia.com>
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch net-next v2] devlink: don't allow to change net namespace for FW_ACTIVATE reload action
  2023-02-13 11:58 [patch net-next v2] devlink: don't allow to change net namespace for FW_ACTIVATE reload action Jiri Pirko
  2023-02-14  6:13 ` Jakub Kicinski
  2023-02-14 14:30 ` patchwork-bot+netdevbpf
@ 2023-02-20  9:01 ` Simon Horman
  2 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2023-02-20  9:01 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, davem, kuba, pabeni, edumazet, jacob.e.keller, moshe

On Mon, Feb 13, 2023 at 12:58:36PM +0100, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@nvidia.com>
> 
> 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 <jiri@nvidia.com>
> ---
> 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.

Reviewed-by: Simon Horman <simon.horman@corigine.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-02-20  9:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-13 11:58 [patch net-next v2] devlink: don't allow to change net namespace for FW_ACTIVATE reload action Jiri Pirko
2023-02-14  6:13 ` Jakub Kicinski
2023-02-14  7:31   ` Jiri Pirko
2023-02-14 14:30 ` patchwork-bot+netdevbpf
2023-02-20  9:01 ` Simon Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.