Set previous session id correctly on SMB3 reconnect
authorSteve French <smfrench@gmail.com>
Wed, 21 Sep 2016 03:56:13 +0000 (22:56 -0500)
committerSteve French <smfrench@gmail.com>
Wed, 12 Oct 2016 17:08:31 +0000 (12:08 -0500)
Signed-off-by: Steve French <steve.french@primarydata.com>
CC: Stable <stable@vger.kernel.org>
Reported-by: David Goebel <davidgoe@microsoft.com>
fs/cifs/smb2pdu.c
fs/cifs/smb2pdu.h

index 967a7904fb8fe0551cf2e389a0fe1b355987e798..e8638432a2335aac523410450bea3a7cb6f75df6 100644 (file)
@@ -604,6 +604,7 @@ SMB2_sess_setup(const unsigned int xid, struct cifs_ses *ses,
        char *security_blob = NULL;
        unsigned char *ntlmssp_blob = NULL;
        bool use_spnego = false; /* else use raw ntlmssp */
+       u64 previous_session = ses->Suid;
 
        cifs_dbg(FYI, "Session Setup\n");
 
@@ -641,6 +642,10 @@ ssetup_ntlmssp_authenticate:
                return rc;
 
        req->hdr.SessionId = 0; /* First session, not a reauthenticate */
+
+       /* if reconnect, we need to send previous sess id, otherwise it is 0 */
+       req->PreviousSessionId = previous_session;
+
        req->Flags = 0; /* MBZ */
        /* to enable echos and oplocks */
        req->hdr.CreditRequest = cpu_to_le16(3);
index ff88d9feb01e7475f75a230c004d5f40a80f14f9..fd3709e8de33eddee8c66cca29cb6653921b020e 100644 (file)
@@ -276,7 +276,7 @@ struct smb2_sess_setup_req {
        __le32 Channel;
        __le16 SecurityBufferOffset;
        __le16 SecurityBufferLength;
-       __le64 PreviousSessionId;
+       __u64 PreviousSessionId;
        __u8   Buffer[1];       /* variable length GSS security buffer */
 } __packed;