Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp48126imu; Thu, 8 Nov 2018 14:32:29 -0800 (PST) X-Google-Smtp-Source: AJdET5fNKkxqTml4psaalEEOQqdNGrOTRVIOnzIluHNUMETRP+g6ZhKj/dku2xYVNLP0IUY7qAvi X-Received: by 2002:a62:4105:: with SMTP id o5-v6mr3113804pfa.85.1541716349551; Thu, 08 Nov 2018 14:32:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541716349; cv=none; d=google.com; s=arc-20160816; b=qSo9yPG8kt4kkz3P/3JSQ1f81H/S2RtIXMbTTNowUriQ4f39NDQE7Z6PcuG5B3s/WN FD508RS/Pk67N7u4EWA0IoeoHuBMrSZR5ikgWik2bj3EWSrFx8PTztrbgJwoLKzTQfjG d0IfnvH40OZQTyvaHjf0GBZzvv3iGM/yARU0opior+IlxxYEcjP3NC7HwKoaaWren4Ym dBpmJnoLPTGrXeV64xkVDgfM5wFW4cob8wpnWeGWDJaYeP/7JMRCkA4mlVQsXxcs4UEg bl5awtQPVvs/s2P+GiVS44GnXz56A6WhaoETph1ykWqGVfldmO/uhkQbYSTUBadmB3ZS GESw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6wdCV6ivOHiZy0EUOe+xaApyMLNjoBF7xKkGpsbx2Jk=; b=CO5K9Yg9nP8E9gliEYVW7ZIXImAdtHsz9257Kmw2CFCOjGUGkguPSgqC3B8pVCW/ex svuQTHA9YirM03R04pAeOYqh3CLCgZgEj5y0dcKwxMf93AjbZuniQ78DIIlZLvC6qdkS d8aWnmhCngaNzTP9HEdpdkqLSCCUU4O4HvP26jTfW744xtIFj/YqNCCzP8IC+2Or55yy BUWBKqskNenf7KDWZA8rg3+HjR9jzX2Sgjxg4KDmqiXnrqI53RuDyyXd5V23iYqq4815 x89x8BJI5crDv7lIPf222v3VISMNt6ce5NvqhAY/9QLV0TMYaR05T1v17tQjUi2B4Imq 05Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ALZVBD68; 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 c18-v6si5407071pls.155.2018.11.08.14.32.13; Thu, 08 Nov 2018 14:32:29 -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; dkim=pass header.i=@kernel.org header.s=default header.b=ALZVBD68; 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 S1729664AbeKIIJa (ORCPT + 99 others); Fri, 9 Nov 2018 03:09:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:56576 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729201AbeKIHht (ORCPT ); Fri, 9 Nov 2018 02:37:49 -0500 Received: from localhost (unknown [208.72.13.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D818C214C1; Thu, 8 Nov 2018 22:00:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541714420; bh=Un731RwgcoTP/gGPyQJP0l1ACNvJHla/M9pH3ru3x9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ALZVBD68u/t0DdrpjL5moOjSNHV7TRNW2sug5D+TFgpRaJ5tqSOPPL4hqENIcnsJb BzckyVEp8ZFSbxgXxIAwX+w/0cGBzsOPcmX0/1Swq8P1/3Y/HOcPlkXKdgW1fJ4e/I 7dE9rBs/CcjRxmPQ4RTm+HP08rheLoXvS8XPx60M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Syms , Aurelien Aptel , Pavel Shilovsky , Steve French , Sasha Levin Subject: [PATCH 4.4 044/114] CIFS: handle guest access errors to Windows shares Date: Thu, 8 Nov 2018 13:50:59 -0800 Message-Id: <20181108215105.139103939@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108215059.051093652@linuxfoundation.org> References: <20181108215059.051093652@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 40920c2bb119fd49ba03e2f97a172171781be442 ] Commit 1a967d6c9b39c226be1b45f13acd4d8a5ab3dc44 ("correctly to anonymous authentication for the NTLM(v2) authentication") introduces a regression in handling errors related to attempting a guest connection to a Windows share which requires authentication. This should result in a permission denied error but actually causes the kernel module to enter a never-ending loop trying to follow a DFS referal which doesn't exist. The base cause of this is the failure now occurs later in the process during tree connect and not at the session setup setup and all errors in tree connect are interpreted as needing to follow the DFS paths which isn't in this case correct. So, check the returned error against EACCES and fail if this is returned error. Feedback from Aurelien: PS> net user guest /activate:no PS> mkdir C:\guestshare PS> icacls C:\guestshare /grant 'Everyone:(OI)(CI)F' PS> new-smbshare -name guestshare -path C:\guestshare -fullaccess Everyone I've tested v3.10, v4.4, master, master+your patch using default options (empty or no user "NU") and user=abc (U). NT_LOGON_FAILURE in session setup: LF This is what you seem to have in 3.10. NT_ACCESS_DENIED in tree connect to the share: AD This is what you get before your infinite loop. | NU U -------------------------------- 3.10 | LF LF 4.4 | LF LF master | AD LF master+patch | AD LF No infinite DFS loop :( All these issues result in mount failing very fast with permission denied. I guess it could be from either the Windows version or the share/folder ACL. A deeper analysis of the packets might reveal more. In any case I did not notice any issues for on a basic DFS setup with the patch so I don't think it introduced any regressions, which is probably all that matters. It still bothers me a little I couldn't hit the bug. I've included kernel output w/ debugging output and network capture of my tests if anyone want to have a look at it. (master+patch = ml-guestfix). Signed-off-by: Mark Syms Reviewed-by: Aurelien Aptel Tested-by: Aurelien Aptel Acked-by: Pavel Shilovsky Signed-off-by: Steve French Signed-off-by: Sasha Levin --- fs/cifs/connect.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 077ad3a06c9a..1eeb4780c3ed 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -3674,6 +3674,9 @@ try_mount_again: if (IS_ERR(tcon)) { rc = PTR_ERR(tcon); tcon = NULL; + if (rc == -EACCES) + goto mount_fail_check; + goto remote_path_check; } -- 2.17.1