Commit 33b63f15 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag '6.7-rc1-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6

Pull smb client fixes from Steve French:

 - multichannel fixes (including a lock ordering fix and an important
   refcounting fix)

 - spnego fix

* tag '6.7-rc1-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
  cifs: fix lock ordering while disabling multichannel
  cifs: fix leak of iface for primary channel
  cifs: fix check of rc in function generate_smb3signingkey
  cifs: spnego: add ';' in HOST_KEY_LEN
parents 05aa69b0 5eef12c4
......@@ -64,8 +64,8 @@ struct key_type cifs_spnego_key_type = {
* strlen(";sec=ntlmsspi") */
#define MAX_MECH_STR_LEN 13
/* strlen of "host=" */
#define HOST_KEY_LEN 5
/* strlen of ";host=" */
#define HOST_KEY_LEN 6
/* strlen of ";ip4=" or ";ip6=" */
#define IP_KEY_LEN 5
......
......@@ -2065,6 +2065,12 @@ void __cifs_put_smb_ses(struct cifs_ses *ses)
ses->chans[i].server = NULL;
}
/* we now account for primary channel in iface->refcount */
if (ses->chans[0].iface) {
kref_put(&ses->chans[0].iface->refcount, release_iface);
ses->chans[0].server = NULL;
}
sesInfoFree(ses);
cifs_put_tcp_session(server, 0);
}
......
......@@ -322,28 +322,32 @@ cifs_disable_secondary_channels(struct cifs_ses *ses)
iface = ses->chans[i].iface;
server = ses->chans[i].server;
/*
* remove these references first, since we need to unlock
* the chan_lock here, since iface_lock is a higher lock
*/
ses->chans[i].iface = NULL;
ses->chans[i].server = NULL;
spin_unlock(&ses->chan_lock);
if (iface) {
spin_lock(&ses->iface_lock);
kref_put(&iface->refcount, release_iface);
ses->chans[i].iface = NULL;
iface->num_channels--;
if (iface->weight_fulfilled)
iface->weight_fulfilled--;
spin_unlock(&ses->iface_lock);
}
spin_unlock(&ses->chan_lock);
if (server && !server->terminate) {
server->terminate = true;
cifs_signal_cifsd_for_reconnect(server, false);
}
spin_lock(&ses->chan_lock);
if (server) {
ses->chans[i].server = NULL;
if (!server->terminate) {
server->terminate = true;
cifs_signal_cifsd_for_reconnect(server, false);
}
cifs_put_tcp_session(server, false);
}
spin_lock(&ses->chan_lock);
}
done:
......
......@@ -458,6 +458,8 @@ generate_smb3signingkey(struct cifs_ses *ses,
ptriplet->encryption.context,
ses->smb3encryptionkey,
SMB3_ENC_DEC_KEY_SIZE);
if (rc)
return rc;
rc = generate_key(ses, ptriplet->decryption.label,
ptriplet->decryption.context,
ses->smb3decryptionkey,
......@@ -466,9 +468,6 @@ generate_smb3signingkey(struct cifs_ses *ses,
return rc;
}
if (rc)
return rc;
#ifdef CONFIG_CIFS_DEBUG_DUMP_KEYS
cifs_dbg(VFS, "%s: dumping generated AES session keys\n", __func__);
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment