Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] Reset TreeId to zero on SMB2 TREE_CONNECT
@ 2017-02-20 11:25 Jan-Marek Glogowski
       [not found] ` <1487589958-20489-1-git-send-email-glogow-iG8UcmBuX++ELgA04lAiVw@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Jan-Marek Glogowski @ 2017-02-20 11:25 UTC (permalink / raw)
  To: linux-cifs-u79uwXL29TY76Z2rM5mHXA

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>
Reviewed-by: Aurelien Aptel <aaptel-IBi9RG/b67k@public.gmane.org>
Tested-by: Aurelien Aptel <aaptel-IBi9RG/b67k@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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-24  4:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-20 11:25 [PATCH] Reset TreeId to zero on SMB2 TREE_CONNECT Jan-Marek Glogowski
     [not found] ` <1487589958-20489-1-git-send-email-glogow-iG8UcmBuX++ELgA04lAiVw@public.gmane.org>
2017-03-23 18:17   ` Jan-Marek Glogowski
     [not found]     ` <efd254dc-ecd6-5ea7-7850-b287c64071c2-iG8UcmBuX++ELgA04lAiVw@public.gmane.org>
2017-03-24  4:30       ` Steve French

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox