Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2334902imm; Thu, 7 Jun 2018 08:59:06 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIFRnm8LBQk/wWYRzo6qCOr6zUGnJKOvqydEzNWiDZKJhSM1RMRj6eWuYaGp8IWVZdrUEUL X-Received: by 2002:a63:65c2:: with SMTP id z185-v6mr2045170pgb.163.1528387146756; Thu, 07 Jun 2018 08:59:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528387146; cv=none; d=google.com; s=arc-20160816; b=auIux7eCZ5sitSBkR92fEHz3P6n1EeBkwTmCJRPuYMM3QX01LtGmb0SmLEihUuYnwH I0nEcDGybchcCS0Q0Pz2i2UJKfkoA0IaleM+jt8oJUM686TBfQNi28ty4FvLriYncbBu yVQX4i024YIeWlW2oSSacenRHeyHrrdmR0E+nPCbnLNB6c0pRwQ627TTqzYbwF2fuhB0 Ao7Jsa2xEF49gCVeEDgcfvZxajDvfOvltpl2AJ0xLqdgpEjWMKgCi+niNXXego9AsTqo qkETWWccTEiRRxmlzLBvv8fH28c3vOTzvpy8mRWMSJPFNCaHirm6ruOVUk/MAtvIFV9w P8aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=O//QYs4rD+W5KwVUtybIXaWLiPY1M+8mznTvypH7IT8=; b=BI82cQi/LMsAYXwm6V0HZE1IqihAMBi5CQ4d1ZEBagYXETRYYV2dsdFhQ0whBCU9DZ OPTJ5d3f4m7tW3XM+I7qcTt6DHDzrmVoCjRultdwDE6O1UlNbCxH7576CrGyciD5+0+9 ipzRySb1V+ISTGFkzHm70Bvw0TV8/o4EzwsIQSobdDWZdNYtNU1ptOXuaYDgsZAU2EaU bz5pjSY+ZGW7+AkU1aCamnN0RO6HmNlhJjGLIjuYTXlrc5AibZ1/3QbjZQgmm5GZgtpV MAWUPlSSmrSQHnswQed4q9W1tfi9m+/R2aEqjZqP+LhwJVgeawmVUiQluHuzc/ic7jh2 6Q9w== 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 k2-v6si53506645plt.374.2018.06.07.08.58.51; Thu, 07 Jun 2018 08:59:06 -0700 (PDT) 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 S934180AbeFGP51 (ORCPT + 99 others); Thu, 7 Jun 2018 11:57:27 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:39383 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932747AbeFGOJI (ORCPT ); Thu, 7 Jun 2018 10:09:08 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvb7-0005Zk-Jm; Thu, 07 Jun 2018 15:09:05 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvb4-0002wA-5L; Thu, 07 Jun 2018 15:09:02 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Daniel N Pettersson" , "Steve French" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 165/410] cifs: Fix autonegotiate security settings mismatch In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.57-rc1 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: Ben Hutchings --- fs/cifs/smb2pdu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -541,8 +541,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))