From patchwork Sun Jun 19 18:38:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 12886802 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4454AC43334 for ; Sun, 19 Jun 2022 18:38:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233983AbiFSSiR (ORCPT ); Sun, 19 Jun 2022 14:38:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229902AbiFSSiQ (ORCPT ); Sun, 19 Jun 2022 14:38:16 -0400 Received: from mail-vs1-xe2f.google.com (mail-vs1-xe2f.google.com [IPv6:2607:f8b0:4864:20::e2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEEA16265 for ; Sun, 19 Jun 2022 11:38:15 -0700 (PDT) Received: by mail-vs1-xe2f.google.com with SMTP id g6so8707186vsb.2 for ; Sun, 19 Jun 2022 11:38:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to:cc; bh=WD1tJoTlVO8iMOFUha8+Jc8kIyGKD6D97x7uiglNq4I=; b=Gp03q5DjC1fX3IT0d5X8eDwOPUBVsPQa7lPbWLCj7z4qmRRAmrK6asFqm7SM4LuoHK XFRrjeln5r49JyM82lOroHiuai2pxblz0GPNozyzRmNnMwv/+hwadSaOPz2PHsFUhuAq 18xb7tjVhbDwSCaR9V14ty4RjTHUHnhgKEVrotXzZ5Kxh4umfFndjgDwk19gbhFFnTez BNtWhRh4/Q4a6jfnZk3qltPig2zR8+onH3iFKEcXGEMUga5m/SsYBzbU2W299GYVvPE8 JR5DmnnwBHWp0yURPAMdmRAw2+O9Jub61n9Y3ryW+/Q6mZzNxxU8hRcECV8yaPkvx8Zi h6wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=WD1tJoTlVO8iMOFUha8+Jc8kIyGKD6D97x7uiglNq4I=; b=wqS/TPPp9kir991mQ3raND7A1+2Jb4ZGdvjhbtM0vYLcPcYb3CZpZIiacMHiEEdObz htnLyLKWI1vw1wfqlHK2KFeSnIbcJUrWKGzsNG8fSmsCLocmqaIIWY0shwXj4eq96JQM wIDrmw9U7BYfc2z9MANYylgwaYfdTQbhMKe9ST0Ah12k+KT2+M3cLnHeB0tMTfdbgV7b JtabG3V39TFUNJhjJ4SVoYb0JYnZSHvx5GT0hQBR/6wrHKHb1jLzsLkZg1GlD5iF7tGe Q7o9fiOmVG3veHM9Ervg4WKVp9CJh2xLketx3FIVThL4NwryTKvagw7QHuPknChJOXO2 OGuQ== X-Gm-Message-State: AJIora83LnXzQ8kcqVA8u3bbvg72FC7Uz8XpvNeFGdysiPFuQktU2l6w pamn4TOv52GzBJtFtalM2Q2dSSbTh5U8WX6iuXAC0dmdE8E= X-Google-Smtp-Source: AGRyM1ufrdEzNruYTJm8XjiHaE2uY9isBZVWxWv7hRdWQvoPF8qIfie7RW9RGW3UFiyqhp660U9hwjltFQmiPgoKWqI= X-Received: by 2002:a05:6102:1052:b0:34b:8a41:b963 with SMTP id h18-20020a056102105200b0034b8a41b963mr8214622vsq.17.1655663894600; Sun, 19 Jun 2022 11:38:14 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Sun, 19 Jun 2022 13:38:03 -0500 Message-ID: Subject: [PATCH][SMB3 cient] fix error connecting to channels (negprot failure) To: CIFS Cc: Shyam Prasad N Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org 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: 4c14d7043fede ("cifs: populate empty hostnames for extra channels") See attached patch Reviewed-by: Shyam Prasad N From 8298f38ce0b95f9a3b5f7d83dbeb7a32c75540cb Mon Sep 17 00:00:00 2001 From: Steve French Date: Sat, 18 Jun 2022 17:24:23 -0500 Subject: [PATCH] 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: 4c14d7043fede ("cifs: populate empty hostnames for extra channels") Signed-off-by: Steve French --- fs/cifs/smb2pdu.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index b515140bad8d..5e8c4737b183 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -570,16 +570,18 @@ assemble_neg_contexts(struct smb2_negotiate_req *req, *total_len += ctxt_len; pneg_ctxt += ctxt_len; - ctxt_len = build_netname_ctxt((struct smb2_netname_neg_context *)pneg_ctxt, - server->hostname); - *total_len += ctxt_len; - pneg_ctxt += ctxt_len; - build_posix_ctxt((struct smb2_posix_neg_context *)pneg_ctxt); *total_len += sizeof(struct smb2_posix_neg_context); pneg_ctxt += sizeof(struct smb2_posix_neg_context); - neg_context_count = 4; + if (server->hostname && (server->hostname[0] != 0)) { + ctxt_len = build_netname_ctxt((struct smb2_netname_neg_context *)pneg_ctxt, + server->hostname); + *total_len += ctxt_len; + pneg_ctxt += ctxt_len; + neg_context_count = 4; + } else /* second channels do not have a hostname */ + neg_context_count = 3; if (server->compress_algorithm) { build_compression_ctxt((struct smb2_compression_capabilities_context *) -- 2.34.1