Skip to content

Commit f5c4ba8

Browse files
Shu Wangsmfrench
authored andcommitted
cifs: release auth_key.response for reconnect.
There is a race that cause cifs reconnect in cifs_mount, - cifs_mount - cifs_get_tcp_session - [ start thread cifs_demultiplex_thread - cifs_read_from_socket: -ECONNABORTED - DELAY_WORK smb2_reconnect_server ] - cifs_setup_session - [ smb2_reconnect_server ] auth_key.response was allocated in cifs_setup_session, and will release when the session destoried. So when session re- connect, auth_key.response should be check and released. Tested with my system: CIFS VFS: Free previous auth_key.response = ffff8800320bbf80 A simple auth_key.response allocation call trace: - cifs_setup_session - SMB2_sess_setup - SMB2_sess_auth_rawntlmssp_authenticate - build_ntlmssp_auth_blob - setup_ntlmv2_rsp Signed-off-by: Shu Wang <[email protected]> Signed-off-by: Steve French <[email protected]> CC: Stable <[email protected]> Reviewed-by: Ronnie Sahlberg <[email protected]>
1 parent 9418333 commit f5c4ba8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

fs/cifs/connect.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4154,6 +4154,14 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,
41544154
cifs_dbg(FYI, "Security Mode: 0x%x Capabilities: 0x%x TimeAdjust: %d\n",
41554155
server->sec_mode, server->capabilities, server->timeAdj);
41564156

4157+
if (ses->auth_key.response) {
4158+
cifs_dbg(VFS, "Free previous auth_key.response = %p\n",
4159+
ses->auth_key.response);
4160+
kfree(ses->auth_key.response);
4161+
ses->auth_key.response = NULL;
4162+
ses->auth_key.len = 0;
4163+
}
4164+
41574165
if (server->ops->sess_setup)
41584166
rc = server->ops->sess_setup(xid, ses, nls_info);
41594167

0 commit comments

Comments
 (0)