From patchwork Fri Feb 17 10:55:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan-Marek Glogowski X-Patchwork-Id: 9579637 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 19811600F6 for ; Fri, 17 Feb 2017 10:55:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3A1F285F9 for ; Fri, 17 Feb 2017 10:55:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E51F9286AD; Fri, 17 Feb 2017 10:55:23 +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.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_TVD_MIME_EPI 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 E86B2285F9 for ; Fri, 17 Feb 2017 10:55:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754504AbdBQKzW (ORCPT ); Fri, 17 Feb 2017 05:55:22 -0500 Received: from ironchief.h-da.de ([141.100.10.235]:5290 "EHLO ironchief.h-da.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752574AbdBQKzV (ORCPT ); Fri, 17 Feb 2017 05:55:21 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2B3CgD31aZY/2soZI1eGgEBAQECAQEBA?= =?us-ascii?q?QgBAQEBg1FhAydfg1macAaBIpBhhFOCDCqFeAKCGEEWAQIBAQEBAQEBYiiEcAE?= =?us-ascii?q?BAQQjBGILDQQDAQIrAgJPCAYBDAYCAQGJWxEKsDmBazomAosxAQEBAQYBAQEBA?= =?us-ascii?q?RQPhgeCSoJqhHSCZoJfAQScAIN1gnyNdodsBReGMkiSVCYBMIEANB4UhQADHYF?= =?us-ascii?q?idAGKagEBAQ?= X-IPAS-Result: =?us-ascii?q?A2B3CgD31aZY/2soZI1eGgEBAQECAQEBAQgBAQEBg1FhAyd?= =?us-ascii?q?fg1macAaBIpBhhFOCDCqFeAKCGEEWAQIBAQEBAQEBYiiEcAEBAQQjBGILDQQDA?= =?us-ascii?q?QIrAgJPCAYBDAYCAQGJWxEKsDmBazomAosxAQEBAQYBAQEBARQPhgeCSoJqhHS?= =?us-ascii?q?CZoJfAQScAIN1gnyNdodsBReGMkiSVCYBMIEANB4UhQADHYFidAGKagEBAQ?= Received: from unknown (HELO mail.fbihome.de) ([141.100.40.107]) by ironchief.h-da.de with ESMTP; 17 Feb 2017 11:55:19 +0100 Received: from [172.16.1.210] (lhm246.muenchen.de [194.113.41.246]) by mail.fbihome.de (Postfix) with ESMTPSA id AD6BA427ED; Fri, 17 Feb 2017 11:53:05 +0100 (CET) Subject: Re: Fix SMB2_TREE_CONNECT requests with the wrong TreeId To: =?UTF-8?Q?Aur=c3=a9lien_Aptel?= , linux-cifs@vger.kernel.org References: <25f3edd0-3abf-f541-d7f8-54ae1dbac081@fbihome.de> <066cc0b2-0e63-8cf6-7d46-578e524cf3bf@fbihome.de> <1a130ab9-84bf-82cb-8c23-e071c286822c@fbihome.de> <461c47b3-a4ae-c21c-26c5-b33dd19f2b37@fbihome.de> From: Jan-Marek Glogowski Message-ID: <41c29ddb-eafa-dc03-ab2b-864919aa4192@fbihome.de> Date: Fri, 17 Feb 2017 11:55:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <461c47b3-a4ae-c21c-26c5-b33dd19f2b37@fbihome.de> 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 Am 15.02.2017 um 15:24 schrieb Jan-Marek Glogowski: > I won't be able to test the patch today but hopefully tomorrow, > depending on the current LiMux stuff. I'm tired too. It compiled for my > old kernel and should work. Took some time to test the 2nd patch and it turned out it doesn't work. The TreeId must be reset before small_smb2_init(SMB2_TREE_CONNECT, ...) call, as this copies the tcon->tid into the smb2 header. This is fixed in the attached patch. Can I add "Reported-by" or "Tested-by" for myself and Suggested-by, and Reviewed-by for you? Do you want to test it? Jan-Marek Reviewed-by: Aurelien Aptel Tested-by: Aurelien Aptel From faf5ea71a567fa9f68daf296e0fa27823f968ee8 Mon Sep 17 00:00:00 2001 From: Jan-Marek Glogowski Date: Fri, 10 Feb 2017 16:43:46 +0100 Subject: [PATCH] Reset TreeId to zero on SMB2_TREE_CONNECT Currently the cifs module breaks the CIFS specs on reconnect as described in http://msdn.microsoft.com/en-us/library/cc246529.aspx: "TreeId (4 bytes): Uniquely identifies the tree connect for the command. This MUST be 0 for the SMB2 TREE_CONNECT Request." Signed-off-by: Jan-Marek Glogowski --- fs/cifs/smb2pdu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 8745722..bdd3292 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -1104,6 +1104,10 @@ static inline void init_copy_chunk_defaults(struct cifs_tcon *tcon) return -EINVAL; } + /* SMB2 TREE_CONNECT request must be called with TreeId == 0 */ + if (tcon) + tcon->tid = 0; + rc = small_smb2_init(SMB2_TREE_CONNECT, tcon, (void **) &req); if (rc) { kfree(unc_path); -- 1.9.1