aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/smb2pdu.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/smb2pdu.c')
-rw-r--r--fs/cifs/smb2pdu.c37
1 files changed, 29 insertions, 8 deletions
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 8f38e33d365b..29e06db5f187 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -588,7 +588,7 @@ SMB2_sess_setup(const unsigned int xid, struct cifs_ses *ses,
588 u16 blob_length = 0; 588 u16 blob_length = 0;
589 struct key *spnego_key = NULL; 589 struct key *spnego_key = NULL;
590 char *security_blob = NULL; 590 char *security_blob = NULL;
591 char *ntlmssp_blob = NULL; 591 unsigned char *ntlmssp_blob = NULL;
592 bool use_spnego = false; /* else use raw ntlmssp */ 592 bool use_spnego = false; /* else use raw ntlmssp */
593 593
594 cifs_dbg(FYI, "Session Setup\n"); 594 cifs_dbg(FYI, "Session Setup\n");
@@ -713,13 +713,7 @@ ssetup_ntlmssp_authenticate:
713 iov[1].iov_len = blob_length; 713 iov[1].iov_len = blob_length;
714 } else if (phase == NtLmAuthenticate) { 714 } else if (phase == NtLmAuthenticate) {
715 req->hdr.SessionId = ses->Suid; 715 req->hdr.SessionId = ses->Suid;
716 ntlmssp_blob = kzalloc(sizeof(struct _NEGOTIATE_MESSAGE) + 500, 716 rc = build_ntlmssp_auth_blob(&ntlmssp_blob, &blob_length, ses,
717 GFP_KERNEL);
718 if (ntlmssp_blob == NULL) {
719 rc = -ENOMEM;
720 goto ssetup_exit;
721 }
722 rc = build_ntlmssp_auth_blob(ntlmssp_blob, &blob_length, ses,
723 nls_cp); 717 nls_cp);
724 if (rc) { 718 if (rc) {
725 cifs_dbg(FYI, "build_ntlmssp_auth_blob failed %d\n", 719 cifs_dbg(FYI, "build_ntlmssp_auth_blob failed %d\n",
@@ -1818,6 +1812,33 @@ SMB2_echo(struct TCP_Server_Info *server)
1818 1812
1819 cifs_dbg(FYI, "In echo request\n"); 1813 cifs_dbg(FYI, "In echo request\n");
1820 1814
1815 if (server->tcpStatus == CifsNeedNegotiate) {
1816 struct list_head *tmp, *tmp2;
1817 struct cifs_ses *ses;
1818 struct cifs_tcon *tcon;
1819
1820 cifs_dbg(FYI, "Need negotiate, reconnecting tcons\n");
1821 spin_lock(&cifs_tcp_ses_lock);
1822 list_for_each(tmp, &server->smb_ses_list) {
1823 ses = list_entry(tmp, struct cifs_ses, smb_ses_list);
1824 list_for_each(tmp2, &ses->tcon_list) {
1825 tcon = list_entry(tmp2, struct cifs_tcon,
1826 tcon_list);
1827 /* add check for persistent handle reconnect */
1828 if (tcon && tcon->need_reconnect) {
1829 spin_unlock(&cifs_tcp_ses_lock);
1830 rc = smb2_reconnect(SMB2_ECHO, tcon);
1831 spin_lock(&cifs_tcp_ses_lock);
1832 }
1833 }
1834 }
1835 spin_unlock(&cifs_tcp_ses_lock);
1836 }
1837
1838 /* if no session, renegotiate failed above */
1839 if (server->tcpStatus == CifsNeedNegotiate)
1840 return -EIO;
1841
1821 rc = small_smb2_init(SMB2_ECHO, NULL, (void **)&req); 1842 rc = small_smb2_init(SMB2_ECHO, NULL, (void **)&req);
1822 if (rc) 1843 if (rc)
1823 return rc; 1844 return rc;