From patchwork Sat May 8 01:13:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 1475696 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Htl2RGsk; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4FcTpP31yHz9sPf for ; Sat, 8 May 2021 11:13:17 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229974AbhEHBOP (ORCPT ); Fri, 7 May 2021 21:14:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229663AbhEHBOP (ORCPT ); Fri, 7 May 2021 21:14:15 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 422D4C061574 for ; Fri, 7 May 2021 18:13:13 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id l13so10897244wru.11 for ; Fri, 07 May 2021 18:13:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=jj44dQhNFytG5cBjQJQ75KKgUkU7SoLzGwkV07LX4VQ=; b=Htl2RGskie87o0poA7zfOZsL6yGcIh54PQo+pyU6Y8Cw0xTJs7tCdJgMjNp4tcsP4F JYVo2MjToRBHGb+IEMsXjn/rOO4XkknMrA1Uq/Ybzl8owWa8Uff96egMMsVtLwcZvgwW SmoUrT5WiNa3C3TANPybt10TPypXZ0R3SzfJgqh0R3oVjqAu56vnGKP//sH+QuSNdBc2 mhmRtFOzZDqP2gWAnHAI7HFP8UzQHmJejW7m363OjHydyaYbTXmQjEvW8fQ6kUDRbEAm 0P6Z5rfIHmnGf2lSV3ea5vpec6ym70PN3loupIDxty886bYnuKVDM5Nr6HNZvWvE7vL+ pbSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=jj44dQhNFytG5cBjQJQ75KKgUkU7SoLzGwkV07LX4VQ=; b=PNFiXXExbvnuknwxdx2tDDgqKxN93tYa0XklOB8yEDdwqBzfC3KFDMu47mehw8yVZe J6FrLKN7Ns6gySeMHNQngeqhXbfx1QFeqevKdugs9Idq3VwsymmaaTJca1Ns6sozbX4j fP5aVgIiZVTqlHrh0GYAiUFWOYmWokca4BzkJg/Wt+RvPEZEVSk5ggsUQ8U8DyeOAywO VnnWPifOgxx1PPFwczWm3SszQHjPxUMz3xr6gexXNWYMJ0fa3Md2N4WCMcTUiIklOx52 VFb2J6+WllP0WidfHUD4OBbflfCMntPo0mFjjCrwrYO3nNnicvysBQgJmxsSTJjDd69j MhGg== X-Gm-Message-State: AOAM530QgWOOkZ1UAhqrzrc3bwhuJEMLTqpX9WFuTwIVror/5pM0V64r +q+L7DWKsanTtHGOoXd5cMFUJSRU8UbK3xi3lUk= X-Google-Smtp-Source: ABdhPJxeosW9pm0pPCHmAlk2wjzfGL42NyJHa6vMlb9bqoIV/a343bcAid7cOAcZki5RP+Wrc91ZJu0SzH+N6iekKMk= X-Received: by 2002:adf:dd4f:: with SMTP id u15mr16568694wrm.308.1620436391863; Fri, 07 May 2021 18:13:11 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Fri, 7 May 2021 20:13:01 -0500 Message-ID: Subject: [PATCH][SMB3] 3 small multichannel client patches To: =?utf-8?q?Aur=C3=A9lien_Aptel?= , Shyam Prasad N Cc: CIFS Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org 1) we were not setting CAP_MULTICHANNEL on negotiate request 2) we were ignoring whether the server set CAP_NEGOTIATE in the response 3) we were silently ignoring multichannel when "max_channels" was > 1 but the user forgot to include "multichannel" in mount line. Reviewed-by: Shyam Prasad N Reviewed-By: Tom Talpey From a2bdd5ceb7090ea4f3ee091da2418f23d270b391 Mon Sep 17 00:00:00 2001 From: Steve French Date: Fri, 7 May 2021 18:24:11 -0500 Subject: [PATCH 1/4] smb3: when mounting with multichannel include it in requested capabilities In the SMB3/SMB3.1.1 negotiate protocol request, we are supposed to advertise CAP_MULTICHANNEL capability when establishing multiple channels has been requested by the user doing the mount. See MS-SMB2 sections 2.2.3 and 3.2.5.2 Without setting it there is some risk that multichannel could fail if the server interpreted the field strictly. Cc: # v5.8+ Signed-off-by: Steve French --- fs/cifs/smb2pdu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index e36c2a867783..a8bf43184773 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -841,6 +841,8 @@ SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses) req->SecurityMode = 0; req->Capabilities = cpu_to_le32(server->vals->req_capabilities); + if (ses->chan_max > 1) + req->Capabilities |= cpu_to_le32(SMB2_GLOBAL_CAP_MULTI_CHANNEL); /* ClientGUID must be zero for SMB2.02 dialect */ if (server->vals->protocol_id == SMB20_PROT_ID) @@ -1032,6 +1034,9 @@ int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon *tcon) pneg_inbuf->Capabilities = cpu_to_le32(server->vals->req_capabilities); + if (tcon->ses->chan_max > 1) + pneg_inbuf->Capabilities |= cpu_to_le32(SMB2_GLOBAL_CAP_MULTI_CHANNEL); + memcpy(pneg_inbuf->Guid, server->client_guid, SMB2_CLIENT_GUID_SIZE); -- 2.27.0