Netdev List
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Simon Horman <simon.horman@corigine.com>
Cc: Jacob Keller <jacob.e.keller@intel.com>,
	netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
	pabeni@redhat.com, edumazet@google.com, moshe@nvidia.com
Subject: Re: [patch net-next] devlink: don't allow to change net namespace for FW_ACTIVATE reload action
Date: Mon, 13 Feb 2023 11:45:16 +0100	[thread overview]
Message-ID: <Y+oUvEcsQE2jfpDa@nanopsycho> (raw)
In-Reply-To: <Y+eW0E9HMPxndN2p@corigine.com>

Sat, Feb 11, 2023 at 02:23:28PM CET, simon.horman@corigine.com wrote:
>On Fri, Feb 10, 2023 at 11:43:04AM -0800, Jacob Keller wrote:
>> 
>> 
>> On 2/10/2023 5:15 AM, Simon Horman wrote:
>> > On Fri, Feb 10, 2023 at 12:58:27PM +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.
>> >> ---
>> >>  net/devlink/dev.c | 5 +++++
>> >>  1 file changed, 5 insertions(+)
>> >>
>> >> diff --git a/net/devlink/dev.c b/net/devlink/dev.c
>> >> index 78d824eda5ec..a6a2bcded723 100644
>> >> --- a/net/devlink/dev.c
>> >> +++ b/net/devlink/dev.c
>> >> @@ -474,6 +474,11 @@ int devlink_nl_cmd_reload(struct sk_buff *skb, struct genl_info *info)
>> >>  	if (info->attrs[DEVLINK_ATTR_NETNS_PID] ||
>> >>  	    info->attrs[DEVLINK_ATTR_NETNS_FD] ||
>> >>  	    info->attrs[DEVLINK_ATTR_NETNS_ID]) {
>> >> +		if (action != DEVLINK_RELOAD_ACTION_DRIVER_REINIT) {
>> >> +			NL_SET_ERR_MSG_MOD(info->extack,
>> >> +					   "Changing namespace is only supported for reinit action");
>> >> +			return -EOPNOTSUPP;
>> >> +		}
>> > 
>> > Is this also applicable in the case where the requested ns (dest_net)
>> > is the same as the current ns, which I think means that the ns
>> > is not changed?
>> > 
>> 
>> In that case wouldn't userspace simply not add the attribute though?
>
>Yes, that may be the case.
>But my question is about the correct behaviour if user space doesn't do that.

Okay. Will send v2.

      reply	other threads:[~2023-02-13 10:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-10 11:58 [patch net-next] devlink: don't allow to change net namespace for FW_ACTIVATE reload action Jiri Pirko
2023-02-10 13:15 ` Simon Horman
2023-02-10 19:43   ` Jacob Keller
2023-02-11 13:23     ` Simon Horman
2023-02-13 10:45       ` Jiri Pirko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y+oUvEcsQE2jfpDa@nanopsycho \
    --to=jiri@resnulli.us \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jacob.e.keller@intel.com \
    --cc=kuba@kernel.org \
    --cc=moshe@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=simon.horman@corigine.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox