]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
cifs: fix check of dfs interlinks
authorPaulo Alcantara <pc@cjr.nz>
Mon, 14 Jun 2021 15:58:20 +0000 (12:58 -0300)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 13 Aug 2021 07:31:46 +0000 (09:31 +0200)
BugLink: https://bugs.launchpad.net/bugs/1938340
[ Upstream commit 889c2a700799f3b6f82210925e1faf4a9b833c4a ]

Interlink is a special type of DFS link that resolves to a different
DFS domain-based namespace.  To determine whether it is an interlink
or not, check if ReferralServers and StorageServers bits are set to 1
and 0 respectively in ReferralHeaderFlags, as specified in MS-DFSC
3.1.5.4.5 Determining Whether a Referral Response is an Interlink.

Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
fs/cifs/dfs_cache.c

index 098b4bc8da59abeb23e8a3df95bf808ff07165d6..d2d686ee10a3fed27ad3148cbe2f446e45d89e09 100644 (file)
@@ -25,8 +25,7 @@
 #define CACHE_HTABLE_SIZE 32
 #define CACHE_MAX_ENTRIES 64
 
-#define IS_INTERLINK_SET(v) ((v) & (DFSREF_REFERRAL_SERVER | \
-                                   DFSREF_STORAGE_SERVER))
+#define IS_DFS_INTERLINK(v) (((v) & DFSREF_REFERRAL_SERVER) && !((v) & DFSREF_STORAGE_SERVER))
 
 struct cache_dfs_tgt {
        char *name;
@@ -170,7 +169,7 @@ static int dfscache_proc_show(struct seq_file *m, void *v)
                                   "cache entry: path=%s,type=%s,ttl=%d,etime=%ld,hdr_flags=0x%x,ref_flags=0x%x,interlink=%s,path_consumed=%d,expired=%s\n",
                                   ce->path, ce->srvtype == DFS_TYPE_ROOT ? "root" : "link",
                                   ce->ttl, ce->etime.tv_nsec, ce->ref_flags, ce->hdr_flags,
-                                  IS_INTERLINK_SET(ce->hdr_flags) ? "yes" : "no",
+                                  IS_DFS_INTERLINK(ce->hdr_flags) ? "yes" : "no",
                                   ce->path_consumed, cache_entry_expired(ce) ? "yes" : "no");
 
                        list_for_each_entry(t, &ce->tlist, list) {
@@ -239,7 +238,7 @@ static inline void dump_ce(const struct cache_entry *ce)
                 ce->srvtype == DFS_TYPE_ROOT ? "root" : "link", ce->ttl,
                 ce->etime.tv_nsec,
                 ce->hdr_flags, ce->ref_flags,
-                IS_INTERLINK_SET(ce->hdr_flags) ? "yes" : "no",
+                IS_DFS_INTERLINK(ce->hdr_flags) ? "yes" : "no",
                 ce->path_consumed,
                 cache_entry_expired(ce) ? "yes" : "no");
        dump_tgts(ce);