Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Jan-Marek Glogowski <glogow-iG8UcmBuX++ELgA04lAiVw@public.gmane.org>
To: "Aurélien Aptel" <aaptel-IBi9RG/b67k@public.gmane.org>,
	linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Fix SMB2_TREE_CONNECT requests with the wrong TreeId
Date: Fri, 17 Feb 2017 11:55:15 +0100	[thread overview]
Message-ID: <41c29ddb-eafa-dc03-ab2b-864919aa4192@fbihome.de> (raw)
In-Reply-To: <461c47b3-a4ae-c21c-26c5-b33dd19f2b37-iG8UcmBuX++ELgA04lAiVw@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 592 bytes --]

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

[-- Attachment #2: 0001-Reset-TreeId-to-zero-on-SMB2_TREE_CONNECT.patch --]
[-- Type: text/x-patch, Size: 1104 bytes --]

>From faf5ea71a567fa9f68daf296e0fa27823f968ee8 Mon Sep 17 00:00:00 2001
From: Jan-Marek Glogowski <glogow-iG8UcmBuX++ELgA04lAiVw@public.gmane.org>
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 <glogow-iG8UcmBuX++ELgA04lAiVw@public.gmane.org>
---
 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


  parent reply	other threads:[~2017-02-17 10:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-10 17:44 Fix SMB2_TREE_CONNECT requests with the wrong TreeId Jan-Marek Glogowski
     [not found] ` <25f3edd0-3abf-f541-d7f8-54ae1dbac081-iG8UcmBuX++ELgA04lAiVw@public.gmane.org>
2017-02-13  8:14   ` Aurélien Aptel
     [not found]     ` <066cc0b2-0e63-8cf6-7d46-578e524cf3bf@fbihome.de>
     [not found]       ` <066cc0b2-0e63-8cf6-7d46-578e524cf3bf-iG8UcmBuX++ELgA04lAiVw@public.gmane.org>
2017-02-14 16:02         ` Aurélien Aptel
     [not found]           ` <mpszihohiad.fsf-zpEvHKhluMwYitT5tn2FcQ@public.gmane.org>
2017-02-14 16:39             ` Jan-Marek Glogowski
     [not found]               ` <1a130ab9-84bf-82cb-8c23-e071c286822c-iG8UcmBuX++ELgA04lAiVw@public.gmane.org>
2017-02-15 13:05                 ` Aurélien Aptel
     [not found]                   ` <mpswpcrhaet.fsf-zpEvHKhluMwYitT5tn2FcQ@public.gmane.org>
2017-02-15 14:24                     ` Jan-Marek Glogowski
     [not found]                       ` <461c47b3-a4ae-c21c-26c5-b33dd19f2b37-iG8UcmBuX++ELgA04lAiVw@public.gmane.org>
2017-02-17 10:55                         ` Jan-Marek Glogowski [this message]
     [not found]                           ` <41c29ddb-eafa-dc03-ab2b-864919aa4192-iG8UcmBuX++ELgA04lAiVw@public.gmane.org>
2017-02-17 18:37                             ` Aurélien Aptel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41c29ddb-eafa-dc03-ab2b-864919aa4192@fbihome.de \
    --to=glogow-ig8ucmbux++elga04laivw@public.gmane.org \
    --cc=aaptel-IBi9RG/b67k@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox