two client fixes, both for stable

-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEE6fsu8pdIjtWE/DpLiiy9cAdyT1EFAmeIk7cACgkQiiy9cAdy
 T1F1IAwAuTZGuIQOnTYV3VzUamT+yzmzbEnxwyMJIS/H/J9F1ZuSobEHepxSCPiX
 dvPUH7ud/AxSfsosyG64mzhm3vvcjN6TO+NDEZhHYWKMSlXvsCjKYh81DnfGbOyF
 lyOFDLoxc8c0Z5WxNTD41Zeic6/WiA9KFipAFC3k6+QUWSbR0KNqZzOWLdejsBjo
 YgzigPdsQXl3SSwvl5+2xhEAJ7xcg8DocnvH87+jGVyhqoFoA2JYls7OUvvdkLpQ
 V7auH7AlDBGFhIk8QNuniUmDw6XXrd3FLJKiawsZk8xLbkoAUUSd6ofLNZszg6E3
 pjoPM/oJe2V5qg/AKXXbjkhUjgn3uqpFIPZNZn0ZrnPBO3XXzMB2mr5bmqZyVN4e
 mYvTiecr64ooe9j4W+cHANFpecy4F7RDfsQK2zi5KY6c8O+30dJ7x1JzdvkS7glv
 y1JC7uj22Gl6UNoBpx2QmJNeycmLuOPfLU8NA2cCH/ZRl+rTEYVNyviLqtIOZPVG
 2gyi/erR
 =RwwN
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2025-01-16 21:18:12 -08:00
commit 9ca2729666
2 changed files with 11 additions and 3 deletions

View File

@ -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) {

View File

@ -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)