Received: by 10.223.185.116 with SMTP id b49csp2508893wrg; Thu, 15 Feb 2018 12:43:50 -0800 (PST) X-Google-Smtp-Source: AH8x224GZUlz1dU2INP3S9gPsgkQfAZ/NXQo8boxJTdVAEGQmljxrM5IF9OTFYrOkIy0zNFzcmg5 X-Received: by 2002:a17:902:3281:: with SMTP id z1-v6mr3676929plb.431.1518727430599; Thu, 15 Feb 2018 12:43:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518727430; cv=none; d=google.com; s=arc-20160816; b=c6ctyQUtB+KIu+33GtdVCRCgf85uWTwTkXhMRR3kMS3Z833zvrh6guzw9iB17ZWK7B HoVY3WyvVG/iEuHGSNYKiTTStDl3MCTiA2pcn2RNzCGOhSAw/laxrF0STr7RvJegOe3k Zh2YcCsZs60CG3XerXY9v2BC+tFFUJ5P9em2AP34czjpTawABheCr9F7N/4sVXVWBOe2 FIeJMX7CQYz6dlj1m499Iocpdw7JJsM4tker8nx7FSABZ6Y2WNhE03YHxBqKG8G+0BS/ 7obpTu7pMuyHabqX5DBASiyuxyN3CxyuDlaKNSioCg56rXujJ7hlyfa9304HCiixti1a ujjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=URqG5cHx1w9jdCVWWMe/VI0fpJ5d9iq5encu6R33hNM=; b=MAfoMaoM9EmCBsY+Fe1Lf0PcZ2vtA9eg91n1qDeT1FL4ZRoiEoOnXXAIMBxQpn5P05 BeJwypzZP45QT7cyZI2SLCthctn4yeM/0xWcr7bEZMXtpnbFJ9ziDzvsgQoHt5eZQ9Ux xwoUwbZRhaVt6IuivdcvQ8okZ1fST8kfPHLIfxHzq/y81rIpz67ZjlQcRHfz9EyTbh5q 1IsCKG73ZbPqN7y+ePXXI9esUHpXIaMnwZI0FVyWBznsr+Ggg8x4kYxkmRYqOAWAllA6 ZqPJHwug+MruiuNWPZW2QsXiY2uUMlJb9sBp1lpZNOQBxZM0gHZF7MtxZU25ug3pIp8F 8aRQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r13-v6si3640490plj.141.2018.02.15.12.43.36; Thu, 15 Feb 2018 12:43:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161856AbeBOPUp (ORCPT + 99 others); Thu, 15 Feb 2018 10:20:45 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:48404 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161799AbeBOPUm (ORCPT ); Thu, 15 Feb 2018 10:20:42 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 452CD110C; Thu, 15 Feb 2018 15:20:41 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel N Pettersson , Steve French Subject: [PATCH 3.18 12/45] cifs: Fix autonegotiate security settings mismatch Date: Thu, 15 Feb 2018 16:17:03 +0100 Message-Id: <20180215144118.480751494@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215144115.863307741@linuxfoundation.org> References: <20180215144115.863307741@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Daniel N Pettersson commit 9aca7e454415f7878b28524e76bebe1170911a88 upstream. 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 = 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 Signed-off-by: Greg Kroah-Hartman --- fs/cifs/smb2pdu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -507,8 +507,7 @@ int smb3_validate_negotiate(const unsign } /* check validate negotiate info response matches what we got earlier */ - if (pneg_rsp->Dialect != - cpu_to_le16(tcon->ses->server->vals->protocol_id)) + if (pneg_rsp->Dialect != cpu_to_le16(tcon->ses->server->dialect)) goto vneg_out; if (pneg_rsp->SecurityMode != cpu_to_le16(tcon->ses->server->sec_mode))