From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D405221F1B; Wed, 19 Mar 2025 14:40:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742395243; cv=none; b=JVT8IYIHjXhn2kmUiWLLFlvt7GzPKN35Vkj/XOZgye/eYsR4RZXhFO0WTExBTO1Rxe5hXUoYSl9MbUor4h7tVxGFYT8j0L+7VNOqcbED+MHyph0yu6zr+JtrJu92sq1O3ypMaJuByT7qJySHNwem4NY66t9YATfLPJP63HyHOzs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742395243; c=relaxed/simple; bh=RaLWivR68e46AjEn/YfYRN6lH4ePLrCEzbsLNymWCC4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=l8JmCEJEKz4bDZYf1POLe5u8aWuT+W+dLfjDk0NzM5LGJwhKJkof/WbLKkyx+YwkPYoUtgyVzB8RX4nmwBvQfEy1SPRikwS8FtNXOibVZAnca7UrZTO8uplYktl0flijgK0A+6h/7sUUVVjGFDa2sZygmyjBaQnhcYXaw+s6zXk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=wwNg4VOW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="wwNg4VOW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FFAFC4CEE4; Wed, 19 Mar 2025 14:40:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1742395243; bh=RaLWivR68e46AjEn/YfYRN6lH4ePLrCEzbsLNymWCC4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wwNg4VOWDbHcsQtso4A5EiDV6dUxDORZKJhHeGOZAjWnd0XHZsGgBcvfx9bteS5f0 hvx7pPY8XDVFqo9+dUGXSMPFa0LqUgicvVIAquyd0VFog/vkV8iOFLpf2Y6yrcY9XY gAxhRjsGMn4P9/u4sg/1ovFQWOAE4Jqz6zphVkVQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Pali=20Roh=C3=A1r?= , Steve French , Sasha Levin Subject: [PATCH 6.6 080/166] cifs: Treat unhandled directory name surrogate reparse points as mount directory nodes Date: Wed, 19 Mar 2025 07:30:51 -0700 Message-ID: <20250319143022.180181699@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250319143019.983527953@linuxfoundation.org> References: <20250319143019.983527953@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Pali Rohár [ Upstream commit b587fd128660d48cd2122f870f720ff8e2b4abb3 ] If the reparse point was not handled (indicated by the -EOPNOTSUPP from ops->parse_reparse_point() call) but reparse tag is of type name surrogate directory type, then treat is as a new mount point. Name surrogate reparse point represents another named entity in the system. >>From SMB client point of view, this another entity is resolved on the SMB server, and server serves its content automatically. Therefore from Linux client point of view, this name surrogate reparse point of directory type crosses mount point. Signed-off-by: Pali Rohár Signed-off-by: Steve French Signed-off-by: Sasha Levin --- fs/smb/client/inode.c | 13 +++++++++++++ fs/smb/common/smbfsctl.h | 3 +++ 2 files changed, 16 insertions(+) diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c index dbb407d5e6dab..b9cf05e0940d0 100644 --- a/fs/smb/client/inode.c +++ b/fs/smb/client/inode.c @@ -1132,6 +1132,19 @@ static int reparse_info_to_fattr(struct cifs_open_info_data *data, rc = server->ops->parse_reparse_point(cifs_sb, full_path, iov, data); + /* + * If the reparse point was not handled but it is the + * name surrogate which points to directory, then treat + * is as a new mount point. Name surrogate reparse point + * represents another named entity in the system. + */ + if (rc == -EOPNOTSUPP && + IS_REPARSE_TAG_NAME_SURROGATE(data->reparse.tag) && + (le32_to_cpu(data->fi.Attributes) & ATTR_DIRECTORY)) { + rc = 0; + cifs_create_junction_fattr(fattr, sb); + goto out; + } } break; } diff --git a/fs/smb/common/smbfsctl.h b/fs/smb/common/smbfsctl.h index a94d658b88e86..6eff3a8bde096 100644 --- a/fs/smb/common/smbfsctl.h +++ b/fs/smb/common/smbfsctl.h @@ -158,6 +158,9 @@ #define IO_REPARSE_TAG_LX_CHR 0x80000025 #define IO_REPARSE_TAG_LX_BLK 0x80000026 +/* If Name Surrogate Bit is set, the file or directory represents another named entity in the system. */ +#define IS_REPARSE_TAG_NAME_SURROGATE(tag) (!!((tag) & 0x20000000)) + /* fsctl flags */ /* If Flags is set to this value, the request is an FSCTL not ioctl request */ #define SMB2_0_IOCTL_IS_FSCTL 0x00000001 -- 2.39.5