aboutsummaryrefslogtreecommitdiff
path: root/fs/cifs/cifsglob.h
diff options
context:
space:
mode:
authorPaulo Alcantara <pc@manguebit.com>2023-04-26 13:43:53 -0300
committerSteve French <stfrench@microsoft.com>2023-05-03 23:29:39 -0500
commit3dc9c433c9dde15477d02b609ccb4328e2adb6dc (patch)
treed097b78d406ba5b6324c3e732ce8aebfc6aa4440 /fs/cifs/cifsglob.h
parentee20d7c6100752eaf2409d783f4f1449c29ea33d (diff)
cifs: protect access of TCP_Server_Info::{origin,leaf}_fullpath
Protect access of TCP_Server_Info::{origin,leaf}_fullpath when matching DFS connections, and get rid of TCP_Server_Info::current_fullpath while we're at it. Cc: stable@vger.kernel.org # v6.2+ Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/cifsglob.h')
-rw-r--r--fs/cifs/cifsglob.h20
1 files changed, 13 insertions, 7 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 08a73dcb7786..a62447404851 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -736,17 +736,23 @@ struct TCP_Server_Info {
#endif
struct mutex refpath_lock; /* protects leaf_fullpath */
/*
- * Canonical DFS full paths that were used to chase referrals in mount and reconnect.
+ * origin_fullpath: Canonical copy of smb3_fs_context::source.
+ * It is used for matching existing DFS tcons.
*
- * origin_fullpath: first or original referral path
- * leaf_fullpath: last referral path (might be changed due to nested links in reconnect)
+ * leaf_fullpath: Canonical DFS referral path related to this
+ * connection.
+ * It is used in DFS cache refresher, reconnect and may
+ * change due to nested DFS links.
*
- * current_fullpath: pointer to either origin_fullpath or leaf_fullpath
- * NOTE: cannot be accessed outside cifs_reconnect() and smb2_reconnect()
+ * Both protected by @refpath_lock and @srv_lock. The @refpath_lock is
+ * mosly used for not requiring a copy of @leaf_fullpath when getting
+ * cached or new DFS referrals (which might also sleep during I/O).
+ * While @srv_lock is held for making string and NULL comparions against
+ * both fields as in mount(2) and cache refresh.
*
- * format: \\HOST\SHARE\[OPTIONAL PATH]
+ * format: \\HOST\SHARE[\OPTIONAL PATH]
*/
- char *origin_fullpath, *leaf_fullpath, *current_fullpath;
+ char *origin_fullpath, *leaf_fullpath;
};
static inline bool is_smb1(struct TCP_Server_Info *server)