Commit f7025d86 authored by Enzo Matsumiya's avatar Enzo Matsumiya Committed by Steve French

smb: client: allocate crypto only for primary server

For extra channels, point ->secmech.{enc,dec} to the primary
server ones.
Signed-off-by: default avatarEnzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent b0abcd65
...@@ -735,13 +735,18 @@ cifs_crypto_secmech_release(struct TCP_Server_Info *server) ...@@ -735,13 +735,18 @@ cifs_crypto_secmech_release(struct TCP_Server_Info *server)
cifs_free_hash(&server->secmech.sha512); cifs_free_hash(&server->secmech.sha512);
cifs_free_hash(&server->secmech.hmacmd5); cifs_free_hash(&server->secmech.hmacmd5);
if (server->secmech.enc) { if (!SERVER_IS_CHAN(server)) {
crypto_free_aead(server->secmech.enc); if (server->secmech.enc) {
server->secmech.enc = NULL; crypto_free_aead(server->secmech.enc);
} server->secmech.enc = NULL;
}
if (server->secmech.dec) { if (server->secmech.dec) {
crypto_free_aead(server->secmech.dec); crypto_free_aead(server->secmech.dec);
server->secmech.dec = NULL;
}
} else {
server->secmech.enc = NULL;
server->secmech.dec = NULL; server->secmech.dec = NULL;
} }
} }
...@@ -1268,9 +1268,13 @@ SMB2_negotiate(const unsigned int xid, ...@@ -1268,9 +1268,13 @@ SMB2_negotiate(const unsigned int xid,
} }
if (server->cipher_type && !rc) { if (server->cipher_type && !rc) {
rc = smb3_crypto_aead_allocate(server); if (!SERVER_IS_CHAN(server)) {
if (rc) rc = smb3_crypto_aead_allocate(server);
cifs_server_dbg(VFS, "%s: crypto alloc failed, rc=%d\n", __func__, rc); } else {
/* For channels, just reuse the primary server crypto secmech. */
server->secmech.enc = server->primary_server->secmech.enc;
server->secmech.dec = server->primary_server->secmech.dec;
}
} }
neg_exit: neg_exit:
free_rsp_buf(resp_buftype, rsp); free_rsp_buf(resp_buftype, rsp);
......
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