Return-Path: Received: from mail-sn1nam02on0127.outbound.protection.outlook.com ([104.47.36.127]:27968 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1032391AbeCAPeD (ORCPT ); Thu, 1 Mar 2018 10:34:03 -0500 From: Sasha Levin To: "stable@vger.kernel.org" , "stable-commits@vger.kernel.org" CC: Daniel N Pettersson , Steve French , Sasha Levin Subject: [added to the 4.1 stable tree] cifs: Fix autonegotiate security settings mismatch Date: Thu, 1 Mar 2018 15:25:56 +0000 Message-ID: <20180301152116.1486-317-alexander.levin@microsoft.com> References: <20180301152116.1486-1-alexander.levin@microsoft.com> In-Reply-To: <20180301152116.1486-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Daniel N Pettersson This patch has been added to the 4.1 stable tree. If you have any objections, please let us know. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [ Upstream commit 9aca7e454415f7878b28524e76bebe1170911a88 ] Autonegotiation gives a security settings mismatch error if the SMB server selects an SMBv3 dialect that isn't SMB3.02. The exact error is "protocol revalidation - security settings mismatch". This can be tested using Samba v4.2 or by setting the global Samba setting max protocol =3D SMB3_00. The check that fails in smb3_validate_negotiate is the dialect verification of the negotiate info response. This is because it tries to verify against the protocol_id in the global smbdefault_values. The protocol_id in smbdefault_values is SMB3.02. In SMB2_negotiate the protocol_id in smbdefault_values isn't updated, it is global so it probably shouldn't be, but server->dialect is. This patch changes the check in smb3_validate_negotiate to use server->dialect instead of server->vals->protocol_id. The patch works with autonegotiate and when using a specific version in the vers mount option. Signed-off-by: Daniel N Pettersson Signed-off-by: Steve French CC: Stable Signed-off-by: Sasha Levin --- fs/cifs/smb2pdu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 0cf4a76e8e94..69422157c71b 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -507,8 +507,7 @@ int smb3_validate_negotiate(const unsigned int xid, str= uct cifs_tcon *tcon) } =20 /* check validate negotiate info response matches what we got earlier */ - if (pneg_rsp->Dialect !=3D - cpu_to_le16(tcon->ses->server->vals->protocol_id)) + if (pneg_rsp->Dialect !=3D cpu_to_le16(tcon->ses->server->dialect)) goto vneg_out; =20 if (pneg_rsp->SecurityMode !=3D cpu_to_le16(tcon->ses->server->sec_mode)) --=20 2.14.1