Commit 9ca27296 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag '6.13-rc7-SMB3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6

Pull smb client fixes from Steve French:

 - fix double free when reconnect racing with closing session

 - fix SMB1 reconnect with password rotation

* tag '6.13-rc7-SMB3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
  smb: client: fix double free of TCP_Server_Info::hostname
  cifs: support reconnect with alternate password for SMB1
parents 9bffa1ad fa2f9906
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -152,8 +152,17 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
	spin_unlock(&ses->ses_lock);

	rc = cifs_negotiate_protocol(0, ses, server);
	if (!rc)
	if (!rc) {
		rc = cifs_setup_session(0, ses, server, ses->local_nls);
		if ((rc == -EACCES) || (rc == -EHOSTDOWN) || (rc == -EKEYREVOKED)) {
			/*
			 * Try alternate password for next reconnect if an alternate
			 * password is available.
			 */
			if (ses->password2)
				swap(ses->password2, ses->password);
		}
	}

	/* do we need to reconnect tcon? */
	if (rc || !tcon->need_reconnect) {
+1 −2
Original line number Diff line number Diff line
@@ -1044,6 +1044,7 @@ clean_demultiplex_info(struct TCP_Server_Info *server)
	/* Release netns reference for this server. */
	put_net(cifs_net_ns(server));
	kfree(server->leaf_fullpath);
	kfree(server->hostname);
	kfree(server);

	length = atomic_dec_return(&tcpSesAllocCount);
@@ -1670,8 +1671,6 @@ cifs_put_tcp_session(struct TCP_Server_Info *server, int from_reconnect)
	kfree_sensitive(server->session_key.response);
	server->session_key.response = NULL;
	server->session_key.len = 0;
	kfree(server->hostname);
	server->hostname = NULL;

	task = xchg(&server->tsk, NULL);
	if (task)