Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2907853iog; Mon, 27 Jun 2022 05:32:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uKOoODRqcPo+ds57GgupoDPW9ChUSPb2LL0fEk9iExLjgoZQJoQ1MZIWRBZtqG2IUnufFN X-Received: by 2002:a63:1759:0:b0:40d:5aba:4bb0 with SMTP id 25-20020a631759000000b0040d5aba4bb0mr12850288pgx.496.1656333157389; Mon, 27 Jun 2022 05:32:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656333157; cv=none; d=google.com; s=arc-20160816; b=oDPEf78cbCUhCcVDTUPLY4vi9Iug9Wmy3EIx6KOG6UmSrOqDbN5u9Re4TG0G5RG1Qx U538HAZmxy4uyMxpBsgyOw5XoDg2S0M9LShRSFXFYGu2URQ2AhhNDPwVLxU/bjLZixOi 2S9ols/NmvFU7walT1jeWfeuS/QAGqfU0JT9GZQEbk7YfLcTBnrHLgVjGPbG7sMbv1eQ caUUzcuEKTgFQK3gvqlzq5u6WbFdm33DDAPO5wDj1wQlH4nMUrDH6s7mhw3b2ACXI/Av /yQtlCpgs/qEDsfiDGHWKaTBfA9OF1QC2znU2vry8oxjQDe44Yes8CVoGhcwwk59vaCS 6Tjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yc/HbbSKSO6nwIH3iUe4bjE14nEIIrTmoAMLHHc+AIw=; b=OQm3qAD0rozfkVkElEqv0daKGTzTawNzxVqG847iZMIbFqqpRwj3KJnTxEAuDZk55o wVrkLZ6Qpa0sxDNLqWdwAhokIIVYqafuQeiJHZYUWs4RVUPyb8+eY6A+Pwr/tKXTucXC MX9MoGbQVtJNnEd3beT1B2w9iReXQYRtmgGK/6Vvsyn6tRnocgHQx8rNvKPCb3DuMBad Do08NjLe4l4N8ZLC2ioGEADlrOnXfYVXkNIf5+BPBX2RyJm5vbWpeffP4BxguJ6/HiFz GrOf1fXJIrjgx2igd94RgZVn3oaDc/cVAkQOyIG4cY9e8nPoVa21a2UMUEUD0yaIKHci n7SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=glXmQciC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s16-20020a056a00195000b0050d80e4935fsi14470078pfk.256.2022.06.27.05.32.24; Mon, 27 Jun 2022 05:32:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=glXmQciC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239635AbiF0MAe (ORCPT + 99 others); Mon, 27 Jun 2022 08:00:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238928AbiF0Lwu (ORCPT ); Mon, 27 Jun 2022 07:52:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8271BDF24; Mon, 27 Jun 2022 04:46:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1F3BE61274; Mon, 27 Jun 2022 11:46:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BF51C3411D; Mon, 27 Jun 2022 11:46:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656330390; bh=Qd/CJBdk7IjouJA7xPLfk0c+qDDiBr7bA/pHqdsM3U0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=glXmQciCVIdOL892duyh8q+tvsHxrtcDIYwn6cuAX/NTreKKmK1pPcAPYh/m5GkSf v1vjvPAR2gT0HXtOs3teJ9e3dApEf78f5OUbr2MxlmfWSDuQ9KMTG25uWPXXZurw8I CVgp201gyv8skECBOVGWLGPqScKWS1LpyNRDAUlI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shyam Prasad N , "Paulo Alcantara (SUSE)" , Steve French Subject: [PATCH 5.18 175/181] smb3: fix empty netname context on secondary channels Date: Mon, 27 Jun 2022 13:22:28 +0200 Message-Id: <20220627111949.758271609@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627111944.553492442@linuxfoundation.org> References: <20220627111944.553492442@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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-kernel@vger.kernel.org From: Steve French commit 73130a7b1ac92c9f30e0a255951129f4851c5794 upstream. 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") Reviewed-by: Shyam Prasad N Reviewed-by: Paulo Alcantara (SUSE) Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/smb2pdu.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -570,16 +570,18 @@ assemble_neg_contexts(struct smb2_negoti *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 *)