From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3179C43461 for ; Mon, 14 Sep 2020 14:41:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AD851205F4 for ; Mon, 14 Sep 2020 14:41:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600094464; bh=kehCFbfvPmd28tKBN501R2yONM3sM5wm1unw4+GdN+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=sAjWoWnF1eIJc+EG/OG9Yne9UUEv/HfLgWqjBYdu+NUCWq1igjQI/vb49ub23g6GT Ni+5qnm4MKr3fhi719Ra9SqDeeu11pxGd5P+MPnIzwnz1E1y7SXOYZA+pOLa8fFLFv RdTQz+nYs6pRCY8CyqNf4PRsNGKazNmi6+BlHToo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726680AbgINOk7 (ORCPT ); Mon, 14 Sep 2020 10:40:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:60296 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726638AbgINNFm (ORCPT ); Mon, 14 Sep 2020 09:05:42 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6EB7C216C4; Mon, 14 Sep 2020 13:04:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600088687; bh=kehCFbfvPmd28tKBN501R2yONM3sM5wm1unw4+GdN+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F10uW4afjqCRCG1Kl/MgxB0gQHe9AgMCti0thEAP0EDwV4CmOWCk3z9oUev9LoXEc ppB6nLlQ0rd6KSPMJxAytZrSsLGrGs2OMXHTmOYiLboL03fB3E77PDSuETjp3A6BJh qFimC1aYvtgwN7GoMnbhn6XtEwNqrl0+TRwLko2A= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ronnie Sahlberg , Paulo Alcantara , Steve French , Sasha Levin , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org Subject: [PATCH AUTOSEL 5.4 10/22] cifs: fix DFS mount with cifsacl/modefromsid Date: Mon, 14 Sep 2020 09:04:22 -0400 Message-Id: <20200914130434.1804478-10-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200914130434.1804478-1-sashal@kernel.org> References: <20200914130434.1804478-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ronnie Sahlberg [ Upstream commit 01ec372cef1e5afa4ab843bbaf88a6fcb64dc14c ] RHBZ: 1871246 If during cifs_lookup()/get_inode_info() we encounter a DFS link and we use the cifsacl or modefromsid mount options we must suppress any -EREMOTE errors that triggers or else we will not be able to follow the DFS link and automount the target. This fixes an issue with modefromsid/cifsacl where these mountoptions would break DFS and we would no longer be able to access the share. Signed-off-by: Ronnie Sahlberg Reviewed-by: Paulo Alcantara (SUSE) Signed-off-by: Steve French Signed-off-by: Sasha Levin --- fs/cifs/inode.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index eb2e3db3916f0..17df90b5f57a2 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -898,6 +898,8 @@ cifs_get_inode_info(struct inode **inode, const char *full_path, if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MODE_FROM_SID) { rc = cifs_acl_to_fattr(cifs_sb, &fattr, *inode, true, full_path, fid); + if (rc == -EREMOTE) + rc = 0; if (rc) { cifs_dbg(FYI, "%s: Get mode from SID failed. rc=%d\n", __func__, rc); @@ -906,6 +908,8 @@ cifs_get_inode_info(struct inode **inode, const char *full_path, } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { rc = cifs_acl_to_fattr(cifs_sb, &fattr, *inode, false, full_path, fid); + if (rc == -EREMOTE) + rc = 0; if (rc) { cifs_dbg(FYI, "%s: Getting ACL failed with error: %d\n", __func__, rc); -- 2.25.1