Skip to content

Commit 735610d

Browse files
metze-sambasmfrench
authored andcommitted
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>
1 parent aa43bb2 commit 735610d

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

fs/smb/common/smbdirect/smbdirect.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ struct smbdirect_socket_parameters {
3232
__u32 resolve_route_timeout_msec;
3333
__u32 rdma_connect_timeout_msec;
3434
__u32 negotiate_timeout_msec;
35-
__u8 initiator_depth;
36-
__u8 responder_resources;
35+
__u16 initiator_depth; /* limited to U8_MAX */
36+
__u16 responder_resources; /* limited to U8_MAX */
3737
__u16 recv_credit_max;
3838
__u16 send_credit_target;
3939
__u32 max_send_size;

fs/smb/common/smbdirect/smbdirect_socket.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ int smbdirect_socket_set_initial_parameters(struct smbdirect_socket *sc,
166166
if (sp->flags & ~SMBDIRECT_FLAG_PORT_RANGE_MASK)
167167
return -EINVAL;
168168

169+
if (sp->initiator_depth > U8_MAX)
170+
return -EINVAL;
171+
if (sp->responder_resources > U8_MAX)
172+
return -EINVAL;
173+
169174
if (sp->flags & SMBDIRECT_FLAG_PORT_RANGE_ONLY_IB &&
170175
sp->flags & SMBDIRECT_FLAG_PORT_RANGE_ONLY_IW)
171176
return -EINVAL;

0 commit comments

Comments
 (0)