OSDN Git Service

cifs: set server->cipher_type to AES-128-CCM for SMB3.0
authorAurelien Aptel <aaptel@suse.com>
Fri, 21 May 2021 15:19:27 +0000 (17:19 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Jun 2021 06:38:02 +0000 (08:38 +0200)
commitd094067852cd1eefbcdc3c110c69265b6ce8c981
tree5d053b1daa7eb3610a380061763d122d2b2dbc9c
parent0365701bc44e078682ee1224866a71897495c7ef
cifs: set server->cipher_type to AES-128-CCM for SMB3.0

commit 6d2fcfe6b517fe7cbf2687adfb0a16cdcd5d9243 upstream.

SMB3.0 doesn't have encryption negotiate context but simply uses
the SMB2_GLOBAL_CAP_ENCRYPTION flag.

When that flag is present in the neg response cifs.ko uses AES-128-CCM
which is the only cipher available in this context.

cipher_type was set to the server cipher only when parsing encryption
negotiate context (SMB3.1.1).

For SMB3.0 it was set to 0. This means cipher_type value can be 0 or 1
for AES-128-CCM.

Fix this by checking for SMB3.0 and encryption capability and setting
cipher_type appropriately.

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/smb2pdu.c