lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230213115836.3404039-1-jiri@resnulli.us>
Date:   Mon, 13 Feb 2023 12:58:36 +0100
From:   Jiri Pirko <jiri@...nulli.us>
To:     netdev@...r.kernel.org
Cc:     davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com,
        edumazet@...gle.com, jacob.e.keller@...el.com, moshe@...dia.com,
        simon.horman@...igine.com
Subject: [patch net-next v2] devlink: don't allow to change net namespace for FW_ACTIVATE reload action

From: Jiri Pirko <jiri@...dia.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@...dia.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ