Skip to content

Commit 73130a7

Browse files
author
Steve French
committed
smb3: fix empty netname context on secondary channels
Some servers do not allow null netname contexts, which would cause multichannel to revert to single channel when mounting to some servers (e.g. Azure xSMB). Fixes: 4c14d70 ("cifs: populate empty hostnames for extra channels") Reviewed-by: Shyam Prasad N <[email protected]> Reviewed-by: Paulo Alcantara (SUSE) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent a111daf commit 73130a7

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

fs/cifs/smb2pdu.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -570,16 +570,18 @@ assemble_neg_contexts(struct smb2_negotiate_req *req,
570570
*total_len += ctxt_len;
571571
pneg_ctxt += ctxt_len;
572572

573-
ctxt_len = build_netname_ctxt((struct smb2_netname_neg_context *)pneg_ctxt,
574-
server->hostname);
575-
*total_len += ctxt_len;
576-
pneg_ctxt += ctxt_len;
577-
578573
build_posix_ctxt((struct smb2_posix_neg_context *)pneg_ctxt);
579574
*total_len += sizeof(struct smb2_posix_neg_context);
580575
pneg_ctxt += sizeof(struct smb2_posix_neg_context);
581576

582-
neg_context_count = 4;
577+
if (server->hostname && (server->hostname[0] != 0)) {
578+
ctxt_len = build_netname_ctxt((struct smb2_netname_neg_context *)pneg_ctxt,
579+
server->hostname);
580+
*total_len += ctxt_len;
581+
pneg_ctxt += ctxt_len;
582+
neg_context_count = 4;
583+
} else /* second channels do not have a hostname */
584+
neg_context_count = 3;
583585

584586
if (server->compress_algorithm) {
585587
build_compression_ctxt((struct smb2_compression_capabilities_context *)

0 commit comments

Comments
 (0)