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: 1645187 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Gp03q5Dj; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by bilbo.ozlabs.org (Postfix) with ESMTP id 4LR1kP2N80z9s2R for ; Mon, 20 Jun 2022 04:38:21 +1000 (AEST) 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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