From patchwork Wed Jun 22 17:40:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 1646666 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=opJR25kn; 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 4LSrJQ2QrBz9sG2 for ; Thu, 23 Jun 2022 03:40:38 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376294AbiFVRkh (ORCPT ); Wed, 22 Jun 2022 13:40:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376298AbiFVRkd (ORCPT ); Wed, 22 Jun 2022 13:40:33 -0400 Received: from mail-ua1-x92d.google.com (mail-ua1-x92d.google.com [IPv6:2607:f8b0:4864:20::92d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13BFA2F671 for ; Wed, 22 Jun 2022 10:40:33 -0700 (PDT) Received: by mail-ua1-x92d.google.com with SMTP id k19so6593891uap.7 for ; Wed, 22 Jun 2022 10:40:33 -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; bh=V1GPNoYupLN1l6N7YoEN1tScrnyWxqAzcapEFkIJZBs=; b=opJR25knYoTrVZ0xqPHsRpde8BBADikg4AXMO/KzvWrz7LweSZwyeleWTm9yUrDvBJ BeMy/aO7rCSqJYI/OounimviS9aN4pPZSaemAI0HqHqoTltOqe1I+ec1RSU/e4hUBIA/ EW6oAdCNXK7AYxewD+E6Ywqb1RYXgiYmgYRpTz3rrLgZszPvY68XIg0JQP12CmRT5ZvC xt//AXF+zmkkYfMBdO9H/5OuFC+iea+pWGUVHZteTrN4YGWcNLfrxi8o2GD9EQX0ycqb TxXPpdcWMYNSa3Fe4D7utgdf4cjs1PyZU7c6T0iNrzcrCSDVFe7+HW5o0RyDJJWaJqq2 jwzQ== 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; bh=V1GPNoYupLN1l6N7YoEN1tScrnyWxqAzcapEFkIJZBs=; b=6FgTAXIwv8Gs2tSuK3l2IAw4kWeb42QUUC7/0HmRo/0a6FFxhXnU468HjItvhtkD3z PDS8ew2LdxD6M6PgK4fy/EH94ys/EAZQYvc8nPQlwgXsiOD1EURyW+gcTb14BHxdDMdD kGDo5t/Zp6wY71UFM6SC8cBN6/cS+aB+b1LDM6gatOYJR6MPARRkadqnwQiw3zxxBMNW 8Ln+LE0qkKtvkAm46qqOdhEDOi2RZGruRkPaEXJQRSKULB8zQf2heEA+QgAu2EOiEZpt e89+1hw368MviKlK7nth1sj5W3B5qm8ExenA4QOguXWtiydWD7f43EzkIHHhU1BSkUcm QTtQ== X-Gm-Message-State: AJIora/nWIEfhidNb5hTa46DsaFjf4ezjM6wgENTHcFsgALD6S3w2JsX fuhK5vfsBguduleKQ9M6+JOmvF3xkShU+O/XLvA+oap7 X-Google-Smtp-Source: AGRyM1tZLK6tJkfAWd0+J5ld0bd0nieAl0L2kGXHl84TYXTZuBJcMvXL0gi1csab4/1w2eXO7ZUFa+HdafOgMKmx69c= X-Received: by 2002:ab0:6704:0:b0:37c:c743:eebe with SMTP id q4-20020ab06704000000b0037cc743eebemr2549390uam.84.1655919631840; Wed, 22 Jun 2022 10:40:31 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Wed, 22 Jun 2022 12:40:21 -0500 Message-ID: Subject: [PATCH][SMB3] follow on patch to make sure secondary channels use the primary channels hostname To: CIFS , 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 See attached. From 97b422704940b97ea259d97f974ad327f648225b Mon Sep 17 00:00:00 2001 From: Shyam Prasad N Date: Wed, 22 Jun 2022 12:36:36 -0500 Subject: [PATCH] smb3: use netname when available 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). The previous patch fixed that, this patch also fixes the secondary channel case by using the netname context used for primary channel for the secondary channel. Fixes: 4c14d7043fede ("cifs: populate empty hostnames for extra channels") Signed-off-by: Shyam Prasad N Signed-off-by: Steve French --- fs/cifs/smb2pdu.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 5e8c4737b183..12b4dddaedb0 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -543,6 +543,7 @@ assemble_neg_contexts(struct smb2_negotiate_req *req, struct TCP_Server_Info *server, unsigned int *total_len) { char *pneg_ctxt; + char *hostname = NULL; unsigned int ctxt_len, neg_context_count; if (*total_len > 200) { @@ -574,9 +575,15 @@ assemble_neg_contexts(struct smb2_negotiate_req *req, *total_len += sizeof(struct smb2_posix_neg_context); pneg_ctxt += sizeof(struct smb2_posix_neg_context); - if (server->hostname && (server->hostname[0] != 0)) { + /* + * secondary channels don't have the hostname field populated + * use the hostname field in the primary channel instead + */ + hostname = CIFS_SERVER_IS_CHAN(server) ? + server->primary_server->hostname : server->hostname; + if (hostname && (hostname[0] != 0)) { ctxt_len = build_netname_ctxt((struct smb2_netname_neg_context *)pneg_ctxt, - server->hostname); + hostname); *total_len += ctxt_len; pneg_ctxt += ctxt_len; neg_context_count = 4; -- 2.34.1