diff mbox series

[net-next,3/3] net: mctp: Allow MCTP_NET_ANY for v2 tag control ioctls

Message ID 20241211-mctp-next-v1-3-e392f3d6d154@codeconstruct.com.au (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series net: mctp: MCTP core updates | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-12-12--00-00 (tests: 795)

Commit Message

Jeremy Kerr Dec. 11, 2024, 5:56 a.m. UTC
With ALLOCTAG2/DROPTAG2, we added a net field, to allow allocating tags
outside of the default network. However, we may still want to use the
same ioctl for a default net, so implement the same NET_ANY logic which
falls back to the default net.

This makes it a little more ergonomic to use the ALLOCTAG2/DROPTAG2
interfaces on simpler MCTP network setups.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
---
 net/mctp/af_mctp.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/net/mctp/af_mctp.c b/net/mctp/af_mctp.c
index 87adb4b81ca3ee7d240c80a8a40c4a2e8a876075..1086bff475c1c475df24aedf09737186f87e196f 100644
--- a/net/mctp/af_mctp.c
+++ b/net/mctp/af_mctp.c
@@ -383,6 +383,9 @@  static int mctp_ioctl_tag_copy_from_user(struct net *net, unsigned long arg,
 		ctl->tag = ctl_compat.tag;
 	}
 
+	if (ctl->net == MCTP_NET_ANY)
+		ctl->net = mctp_default_net(net);
+
 	if (ctl->flags)
 		return -EINVAL;