From patchwork Thu Aug 24 22:16:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovskiy X-Patchwork-Id: 9921047 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 28E2760353 for ; Thu, 24 Aug 2017 22:16:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AE771FF73 for ; Thu, 24 Aug 2017 22:16:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0DEBB1FF81; Thu, 24 Aug 2017 22:16:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92E511FF73 for ; Thu, 24 Aug 2017 22:16:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753590AbdHXWQx (ORCPT ); Thu, 24 Aug 2017 18:16:53 -0400 Received: from mail-cys01nam02on0111.outbound.protection.outlook.com ([104.47.37.111]:59449 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753423AbdHXWQu (ORCPT ); Thu, 24 Aug 2017 18:16:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=16ykcLcB8GR2aXRmYTqmC96xEVqCg5gEhyRZuqMKgVQ=; b=UK572hEXxU1ejfdma5QBlh4a6w8p9QosMF6FUMKvCnfYTzvnZ7Vu8or1so7Ejp9pg9LxYJhfjbE0yXaniTKCQAMw1TWeinzuJ48fBDdWiJyGIiOtAvwk6k4hcOHag+7OmLh6r5/wHshCNBKXbimcTjUfWj2dmCZyWSrHt1Mts9Y= Received: from ubuntu-vm.corp.microsoft.com (2001:4898:80e8:c::63b) by DM5PR21MB0139.namprd21.prod.outlook.com (10.173.173.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.0; Thu, 24 Aug 2017 22:16:47 +0000 From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Cc: pshilov@microsoft.com, piastryyy@gmail.com, Steve French Subject: [PATCH] CIFS: Fix maximum SMB2 header size Date: Thu, 24 Aug 2017 15:16:40 -0700 Message-Id: <1503613000-2319-1-git-send-email-pshilov@microsoft.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [2001:4898:80e8:c::63b] X-ClientProxiedBy: BN6PR2001CA0041.namprd20.prod.outlook.com (10.172.27.27) To DM5PR21MB0139.namprd21.prod.outlook.com (10.173.173.14) X-MS-Office365-Filtering-Correlation-Id: 6536a7f5-7ac3-4bc8-093c-08d4eb3dd024 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(48565401081)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DM5PR21MB0139; X-Microsoft-Exchange-Diagnostics: 1; DM5PR21MB0139; 3:tbJmKt1p7hgC7iuaCUEXPl3X3DFBhSJGKosCGMUhV7bqNIdkZnzlw4AtO+//8unvrADfsZ86ijeyHtOurSwhVMP2+tvJHJxvpv5T1ky0Wod3bCGvSl0tIdT5xZHIcj2w1bvvdDKgCWK33awfMTI/Q8LxUrWzBDlcqZ5OpxL3zQBRwhS9v6GVSBvEU5N5uD09YlwTpKsgMqbVCyOtcvMV2OapJFf/RCSVSUoA31a65PQyDefHgu0dCwkmcZ/RCpHU; 25:KTmR9HSCa+otNiR7K6/wnywpynBGzj/i55uNcp7B7Umg/TbtCzh00zR/7we1DsmOJCS0j737+sUM5Hxka39Upjp0OeIMhdAlGEMChWF1qvyxoa2eIt6Y0+vjx1aaM2ZdtRUpNonrDVYcOM60AT5ri6cfsgipWfALpnzrpfw3dKxmGBl2MWGxsNfnN8opWPutHln2ECgwB1hOE/9IXNOAVLXvPi7I1tm6LEWFeVYT/qt10qLjq29pp9m7IKFWfzdmLpe4dLUqRy5dIWEsJMJlAQoKesG7dQ7zkYeuvEvpXnvKkbsFmr8YGV4Ktvki86xBCo036OGH5b5v1ITrTsQVOQ==; 31:vNWsac/MCazPx7LCJghWYImO3xkSD9a1nowVCeZCPsSt2pd7/fE0Jpd1G/zWzfNEwtzbEdRkNth4ZgQVEVUWTvR608x6a0TSjDGNoX4CxK5/UBYg5ciJUUGn4nkQxzMV97W0Mi11ICeBVZHhXW2ogq5TPBprivAuZ4qwI6QJQV+rP7ARfWSHXZqdaiS7bwwIh+Yjzn+1Ftzx1UllLzUjPaEKf/WyiqJikwZkOxwU43A= X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR21MB0139: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=pshilov@microsoft.com; X-Microsoft-Exchange-Diagnostics: 1; DM5PR21MB0139; 20:Yx8H/UEvd0N6IxSxakCJDO82MffHAJdz3jw0P/eubODJs89m0c0yADeL4fOsVo4eI90cl0xmo4ywG8FvgOw8U/f1u1GAlatJFyXb8584EskX13ThDRXY8m4WCAdLVINqJoP0Uv+aVu3G4SktnOfunBAIoJOlR4Jl1s5beJL1S10o2896p7Okm8iOKrIkvVWpBWpK9ZUwkXGJMZvy++0AeJ1+yLa0n/UZ7O+64Es4GBbpvIS87OW75YcPhqo7uzze/aerB9EG4VT2xfCPfVOgI8bKoggG2IfZqaaY0pkMS4qzwRiRF8ENaa5AxLHDtFi2Dp95XW9+4ikvGLy3fQFzGAkm5ARmfTPyMaJrd9cWT/TXar7oixDbrSkLPhPmvegUytOMQ2jeBkhVglczenliPTHISX7p04eEPRzu16FelMxtmtqviO2cusvS/hTFmvuY7NTzTdS4FezHT6mbH0fz23snxPrteSkcCxgtiSItYs1UEptlMHn1+jh7OjW2q4bh; 4:9gYGcnTm9BjH4hJG1yOmqz5ptkPNvAhrGjV0VIsH4qM/hu6/udV2ob7Ml8OhaZxEUVDce034q6aE/E9KGKlxM1eZicZ6GYREpHqsM5tlTpiLGdE2eBvc0GNpcq5lJ2melP4Gnf5gR0ZG/tYlng5WaTrdPmmJWttkFvhvwbS6IU3AZP7srfNxpo884NpgbrU4t517R/9yTIbBugUODSBQj+E2tX+bIV7mVtP5ftnWYYNv7tzLRbGCmVi3JpZFQxoXPsyCO0rcIpOIRNADKG79YM5vAx45Vt6CkQsGgrHQ52My37/FVaMprgJD08MtQc3fD/snYvV8FBx0hhRjcIFllw== X-Exchange-Antispam-Report-Test: UriScan:(89211679590171)(9452136761055); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6041248)(20161123558100)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123562025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR21MB0139; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR21MB0139; X-Forefront-PRVS: 04097B7F7F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(7370300001)(6009001)(39860400002)(47760400005)(189002)(199003)(48376002)(189998001)(5660300001)(101416001)(68736007)(36756003)(6116002)(10090500001)(2906002)(6666003)(6916009)(5005710100001)(50986999)(7350300001)(106356001)(8676002)(81156014)(81166006)(5003940100001)(50226002)(25786009)(47776003)(105586002)(10290500003)(110136004)(53936002)(86362001)(42186005)(33646002)(50466002)(97736004)(7736002)(305945005)(478600001)(6486002)(86612001)(4326008)(2361001)(2351001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR21MB0139; H:ubuntu-vm.corp.microsoft.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR21MB0139; 23:HzBqJH4W7ODcJ8S2RYT0CCIsDFGD5Q8KnBe2g6S97?= =?us-ascii?Q?y9KXYptT9Yrf7SZzp8rqFyBauP+FPD7gPo3YCt27PABiYchB3VFAm38CMrvp?= =?us-ascii?Q?idX8LMzHncVZ9Vj8i7Y3NJn6vTH6CO7eQK0HX/wpK6GOVVqsYVAiVO/YeU79?= =?us-ascii?Q?R8mPWN0Ge5v43yHsKZXZatTYr8Wf4VMrd6pbNMV7kAgHwk1lTW3SBDRXS+WF?= =?us-ascii?Q?r9sOf17l+UVoLsxOfvWxOafmU3FsQY4n+uOekv/oc1T3JTzSpQTJNxlVBO9h?= =?us-ascii?Q?T2pmYe4bxLDcyBJKrIuZo/xQvBj7MEqa0zwx6yqZgZ3/eTHVTwlSakUhxPmY?= =?us-ascii?Q?VaUv2+AkGvtL2pb4teX3pSo2/s22BIn0KeFL3jt8Gx99aYmIPzM2a7eoicCb?= =?us-ascii?Q?M57E6us7xwj8iguDjJ5VyD3uoIFdZ1s3EnuCFwkb3RzGLK+qAYHqDJF7cXvP?= =?us-ascii?Q?fWGIQvq8pxbobb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MES1zMBcU6fUYzHu4J9pWVvdUVX9XMJLB+6B4K2fHFlbTlSYiIXX9sm/z6N6xFot98BBPpAClT/MII7ahlgxgmgao/uRuEQV2PRtH8PgJjxzdjf3GXrqZTEHCCSp4k3h3B79QHGL52GQ9KAq1s6+7+7kW+DgEyKg==; 5:Yy0qaWnxLq6aegVbiErDIbQDaz6BdE0/4Y4xF6UJNOKO1rRUuGpBMxHQoFBpeUwfoCEBgGlpdx2/gXdA/LjN4LMfiMS9Mn2pJtWfgNcS11HdH75TITCOLk6pFuSiTvt1Jy3XftV92VJOdo1xqUkqcA==; 24:IAwBu43+y2QEyb7VoK2O2wygNfdLtuJkFc40NTFMxiLIMPLJz2ZdmbEMXCa3MXb2OL/RmsZ3C4niJEbaag6jU49xiLcdJcQW+hgBfc1ORpA=; 7:NdG+5i81bUY1pQRTg2IGi4OIBLNT0J4wtjAWGjFs3jmB8Qvk3pZupgSr0bjV6XgnwlIGHHjI4uU+okAqU5XqcEnQTM8J6bsbgS82dSiWl1qty+jwgGq3i8Rq5LL/cV6KnqmLkMatGCIoFg/+39T0TEPMgZpSXijD+gTKpnz3EBTBwfwJ9lC7c2JbpU4PqmxqztUnD6SO3ynQGuGilnVcPrMUvjkeOqrkyrDOb7ft3r0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2017 22:16:47.6450 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR21MB0139 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently the maximum size of SMB2/3 header is set incorrectly which leads to hanging of directory listing operations on encrypted SMB3 connections. Fix this by setting the maximum size to 170 bytes that is calculated as RFC1002 length field size (4) + transform header size (52) + SMB2 header size (64) + create response size (56). Cc: Signed-off-by: Pavel Shilovsky Acked-by: Sachin Prabhu --- fs/cifs/smb2pdu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h index 18700fd..2826882 100644 --- a/fs/cifs/smb2pdu.h +++ b/fs/cifs/smb2pdu.h @@ -84,8 +84,8 @@ #define NUMBER_OF_SMB2_COMMANDS 0x0013 -/* BB FIXME - analyze following length BB */ -#define MAX_SMB2_HDR_SIZE 0x78 /* 4 len + 64 hdr + (2*24 wct) + 2 bct + 2 pad */ +/* 4 len + 52 transform hdr + 64 hdr + 56 create rsp */ +#define MAX_SMB2_HDR_SIZE 0x00b0 #define SMB2_PROTO_NUMBER cpu_to_le32(0x424d53fe) #define SMB2_TRANSFORM_PROTO_NUM cpu_to_le32(0x424d53fd)