aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve French <smfrench@gmail.com>2016-09-20 23:56:13 -0400
committerSteve French <smfrench@gmail.com>2016-10-12 13:08:31 -0400
commitc2afb8147e69819885493edf3a7c1ce03aaf2d4e (patch)
tree280a23800e282ba1a79a3297c4cfdbcf241975ff
parent7d414f396c91a3382e51cf628c1cf0709ad0188b (diff)
Set previous session id correctly on SMB3 reconnect
Signed-off-by: Steve French <steve.french@primarydata.com> CC: Stable <stable@vger.kernel.org> Reported-by: David Goebel <davidgoe@microsoft.com>
-rw-r--r--fs/cifs/smb2pdu.c5
-rw-r--r--fs/cifs/smb2pdu.h2
2 files changed, 6 insertions, 1 deletions
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 967a7904fb8f..e8638432a233 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -604,6 +604,7 @@ SMB2_sess_setup(const unsigned int xid, struct cifs_ses *ses,
604 char *security_blob = NULL; 604 char *security_blob = NULL;
605 unsigned char *ntlmssp_blob = NULL; 605 unsigned char *ntlmssp_blob = NULL;
606 bool use_spnego = false; /* else use raw ntlmssp */ 606 bool use_spnego = false; /* else use raw ntlmssp */
607 u64 previous_session = ses->Suid;
607 608
608 cifs_dbg(FYI, "Session Setup\n"); 609 cifs_dbg(FYI, "Session Setup\n");
609 610
@@ -641,6 +642,10 @@ ssetup_ntlmssp_authenticate:
641 return rc; 642 return rc;
642 643
643 req->hdr.SessionId = 0; /* First session, not a reauthenticate */ 644 req->hdr.SessionId = 0; /* First session, not a reauthenticate */
645
646 /* if reconnect, we need to send previous sess id, otherwise it is 0 */
647 req->PreviousSessionId = previous_session;
648
644 req->Flags = 0; /* MBZ */ 649 req->Flags = 0; /* MBZ */
645 /* to enable echos and oplocks */ 650 /* to enable echos and oplocks */
646 req->hdr.CreditRequest = cpu_to_le16(3); 651 req->hdr.CreditRequest = cpu_to_le16(3);
diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h
index ff88d9feb01e..fd3709e8de33 100644
--- a/fs/cifs/smb2pdu.h
+++ b/fs/cifs/smb2pdu.h
@@ -276,7 +276,7 @@ struct smb2_sess_setup_req {
276 __le32 Channel; 276 __le32 Channel;
277 __le16 SecurityBufferOffset; 277 __le16 SecurityBufferOffset;
278 __le16 SecurityBufferLength; 278 __le16 SecurityBufferLength;
279 __le64 PreviousSessionId; 279 __u64 PreviousSessionId;
280 __u8 Buffer[1]; /* variable length GSS security buffer */ 280 __u8 Buffer[1]; /* variable length GSS security buffer */
281} __packed; 281} __packed;
282 282