]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
smb: client: fix return value of parse_dfs_referrals()
authorPaulo Alcantara <pc@manguebit.com>
Fri, 10 Jan 2025 19:45:44 +0000 (16:45 -0300)
committerSteve French <stfrench@microsoft.com>
Mon, 20 Jan 2025 01:34:00 +0000 (19:34 -0600)
Return -ENOENT in parse_dfs_referrals() when server returns no targets
for a referral request as specified in

  MS-DFSC 3.1.5.4.3 Receiving a Root Referral Response or Link
  Referral Response:

    > If the referral request is successful, but the NumberOfReferrals
    > field in the referral header (as specified in section 2.2.4) is
    > 0, the DFS server could not find suitable targets to return to
    > the client.  In this case, the client MUST fail the original I/O
    > operation with STATUS_OBJECT_PATH_NOT_FOUND.

Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/misc.c
fs/smb/client/smb2ops.c

index a6efd3644e6a831e5591f73dae8c3d1501aaaf20..b328dc5c7988dea9c8fee05e8b032301e4c5a035 100644 (file)
@@ -909,9 +909,9 @@ parse_dfs_referrals(struct get_dfs_referral_rsp *rsp, u32 rsp_size,
        *num_of_nodes = le16_to_cpu(rsp->NumberOfReferrals);
 
        if (*num_of_nodes < 1) {
-               cifs_dbg(VFS, "num_referrals: must be at least > 0, but we get num_referrals = %d\n",
-                        *num_of_nodes);
-               rc = -EINVAL;
+               cifs_dbg(VFS | ONCE, "%s: [path=%s] num_referrals must be at least > 0, but we got %d\n",
+                        __func__, searchName, *num_of_nodes);
+               rc = -ENOENT;
                goto parse_DFS_referrals_exit;
        }
 
index 87cb1872db28b038cae94e082ae2ad9833bf3b15..0af4abf78a8ece464c393618b3b495bb22f5df77 100644 (file)
@@ -3007,9 +3007,9 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses,
                                 num_of_nodes, target_nodes,
                                 nls_codepage, remap, search_name,
                                 true /* is_unicode */);
-       if (rc) {
-               cifs_tcon_dbg(VFS, "parse error in %s rc=%d\n", __func__, rc);
-               goto out;
+       if (rc && rc != -ENOENT) {
+               cifs_tcon_dbg(VFS, "%s: failed to parse DFS referral %s: %d\n",
+                             __func__, search_name, rc);
        }
 
  out: