summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2026-04-07 17:46:27 +0300
committerSteve French <stfrench@microsoft.com>2026-04-16 05:58:24 +0300
commit735610d0cefa9e44b28498b53706ed2ebac3be27 (patch)
treee8a4d7747ffafc2aecbb61f7144ecb1f2c9e7313
parentaa43bb2c0fc0d928bb120f853349c8affcfeb8b4 (diff)
downloadlinux-735610d0cefa9e44b28498b53706ed2ebac3be27.tar.xz
smb: smbdirect: change smbdirect_socket_parameters.{initiator_depth,responder_resources} to __u16
We still limit this to U8_MAX as the rdma api only uses __u8 and that's also the limit for Infiniband and RoCE*, while iWarp would be able to support larger values at the protocol level. As struct smbdirect_socket_parameters will be part of the uapi for IPPROTO_SMBDIRECT in future, change it now even if userspace sockets won't be supported yet. Cc: Steve French <smfrench@gmail.com> Cc: Tom Talpey <tom@talpey.com> Cc: Long Li <longli@microsoft.com> Cc: Namjae Jeon <linkinjeon@kernel.org> Cc: David Howells <dhowells@redhat.com> Cc: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Acked-by: Henrique Carvalho <henrique.carvalho@suse.com> Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Steve French <stfrench@microsoft.com>
-rw-r--r--fs/smb/common/smbdirect/smbdirect.h4
-rw-r--r--fs/smb/common/smbdirect/smbdirect_socket.c5
2 files changed, 7 insertions, 2 deletions
diff --git a/fs/smb/common/smbdirect/smbdirect.h b/fs/smb/common/smbdirect/smbdirect.h
index e70a21eb57f0..8fbffe3eb845 100644
--- a/fs/smb/common/smbdirect/smbdirect.h
+++ b/fs/smb/common/smbdirect/smbdirect.h
@@ -32,8 +32,8 @@ struct smbdirect_socket_parameters {
__u32 resolve_route_timeout_msec;
__u32 rdma_connect_timeout_msec;
__u32 negotiate_timeout_msec;
- __u8 initiator_depth;
- __u8 responder_resources;
+ __u16 initiator_depth; /* limited to U8_MAX */
+ __u16 responder_resources; /* limited to U8_MAX */
__u16 recv_credit_max;
__u16 send_credit_target;
__u32 max_send_size;
diff --git a/fs/smb/common/smbdirect/smbdirect_socket.c b/fs/smb/common/smbdirect/smbdirect_socket.c
index 1e3b361728cc..4003753bea26 100644
--- a/fs/smb/common/smbdirect/smbdirect_socket.c
+++ b/fs/smb/common/smbdirect/smbdirect_socket.c
@@ -166,6 +166,11 @@ int smbdirect_socket_set_initial_parameters(struct smbdirect_socket *sc,
if (sp->flags & ~SMBDIRECT_FLAG_PORT_RANGE_MASK)
return -EINVAL;
+ if (sp->initiator_depth > U8_MAX)
+ return -EINVAL;
+ if (sp->responder_resources > U8_MAX)
+ return -EINVAL;
+
if (sp->flags & SMBDIRECT_FLAG_PORT_RANGE_ONLY_IB &&
sp->flags & SMBDIRECT_FLAG_PORT_RANGE_ONLY_IW)
return -EINVAL;