diff options
author | Enzo Matsumiya <ematsumiya@suse.de> | 2024-09-26 19:46:14 +0200 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2024-09-27 01:15:02 +0200 |
commit | f7025d861694362348efc14eaad6a17840c4e9a4 (patch) | |
tree | c3229209a018ee8dd55bb6aa9a832e6fc5bf8c5c /fs/smb/client/smb2pdu.c | |
parent | smb: client: fix UAF in async decryption (diff) | |
download | linux-f7025d861694362348efc14eaad6a17840c4e9a4.tar.xz linux-f7025d861694362348efc14eaad6a17840c4e9a4.zip |
smb: client: allocate crypto only for primary server
For extra channels, point ->secmech.{enc,dec} to the primary
server ones.
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to '')
-rw-r--r-- | fs/smb/client/smb2pdu.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c index cb423bfe7377..02828b9c3cb3 100644 --- a/fs/smb/client/smb2pdu.c +++ b/fs/smb/client/smb2pdu.c @@ -1268,9 +1268,13 @@ SMB2_negotiate(const unsigned int xid, } if (server->cipher_type && !rc) { - rc = smb3_crypto_aead_allocate(server); - if (rc) - cifs_server_dbg(VFS, "%s: crypto alloc failed, rc=%d\n", __func__, rc); + if (!SERVER_IS_CHAN(server)) { + rc = smb3_crypto_aead_allocate(server); + } 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: free_rsp_buf(resp_buftype, rsp); |