All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] cifs: don't call cifs_dfs_query_info_nonascii_quirk() if nodfs was set
@ 2022-05-18 16:31 Enzo Matsumiya
  2022-05-20 22:41 ` Steve French
  0 siblings, 1 reply; 2+ messages in thread
From: Enzo Matsumiya @ 2022-05-18 16:31 UTC (permalink / raw)
  To: linux-cifs; +Cc: smfrench, pc, ronniesahlberg, nspmangalore, Enzo Matsumiya

Also return EOPNOTSUPP if path is remote but nodfs was set.

Fixes: a2809d0e1696 ("cifs: quirk for STATUS_OBJECT_NAME_INVALID returned for non-ASCII dfs refs")
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
---
v2: remove useles !nodfs check before calling
    cifs_dfs_query_info_nonascii_quirk()

 fs/cifs/connect.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 42e14f408856..0505d7782e42 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -3432,6 +3432,7 @@ static int is_path_remote(struct mount_ctx *mnt_ctx)
 	struct cifs_tcon *tcon = mnt_ctx->tcon;
 	struct smb3_fs_context *ctx = mnt_ctx->fs_ctx;
 	char *full_path;
+	bool nodfs = cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_DFS;
 
 	if (!server->ops->is_path_accessible)
 		return -EOPNOTSUPP;
@@ -3449,14 +3450,20 @@ static int is_path_remote(struct mount_ctx *mnt_ctx)
 	rc = server->ops->is_path_accessible(xid, tcon, cifs_sb,
 					     full_path);
 #ifdef CONFIG_CIFS_DFS_UPCALL
+	if (nodfs) {
+		if (rc == -EREMOTE)
+			rc = -EOPNOTSUPP;
+		goto out;
+	}
+
+	/* path *might* exist with non-ASCII characters in DFS root
+	 * try again with full path (only if nodfs is not set) */
 	if (rc == -ENOENT && is_tcon_dfs(tcon))
 		rc = cifs_dfs_query_info_nonascii_quirk(xid, tcon, cifs_sb,
 							full_path);
 #endif
-	if (rc != 0 && rc != -EREMOTE) {
-		kfree(full_path);
-		return rc;
-	}
+	if (rc != 0 && rc != -EREMOTE)
+		goto out;
 
 	if (rc != -EREMOTE) {
 		rc = cifs_are_all_path_components_accessible(server, xid, tcon,
@@ -3468,6 +3475,7 @@ static int is_path_remote(struct mount_ctx *mnt_ctx)
 		}
 	}
 
+out:
 	kfree(full_path);
 	return rc;
 }
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] cifs: don't call cifs_dfs_query_info_nonascii_quirk() if nodfs was set
  2022-05-18 16:31 [PATCH v2] cifs: don't call cifs_dfs_query_info_nonascii_quirk() if nodfs was set Enzo Matsumiya
@ 2022-05-20 22:41 ` Steve French
  0 siblings, 0 replies; 2+ messages in thread
From: Steve French @ 2022-05-20 22:41 UTC (permalink / raw)
  To: Enzo Matsumiya; +Cc: CIFS, Paulo Alcantara, ronnie sahlberg, Shyam Prasad N

merged into cifs-2.6.git for-next and added cc:stable

On Wed, May 18, 2022 at 11:32 AM Enzo Matsumiya <ematsumiya@suse.de> wrote:
>
> Also return EOPNOTSUPP if path is remote but nodfs was set.
>
> Fixes: a2809d0e1696 ("cifs: quirk for STATUS_OBJECT_NAME_INVALID returned for non-ASCII dfs refs")
> Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
> ---
> v2: remove useles !nodfs check before calling
>     cifs_dfs_query_info_nonascii_quirk()
>
>  fs/cifs/connect.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 42e14f408856..0505d7782e42 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -3432,6 +3432,7 @@ static int is_path_remote(struct mount_ctx *mnt_ctx)
>         struct cifs_tcon *tcon = mnt_ctx->tcon;
>         struct smb3_fs_context *ctx = mnt_ctx->fs_ctx;
>         char *full_path;
> +       bool nodfs = cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_DFS;
>
>         if (!server->ops->is_path_accessible)
>                 return -EOPNOTSUPP;
> @@ -3449,14 +3450,20 @@ static int is_path_remote(struct mount_ctx *mnt_ctx)
>         rc = server->ops->is_path_accessible(xid, tcon, cifs_sb,
>                                              full_path);
>  #ifdef CONFIG_CIFS_DFS_UPCALL
> +       if (nodfs) {
> +               if (rc == -EREMOTE)
> +                       rc = -EOPNOTSUPP;
> +               goto out;
> +       }
> +
> +       /* path *might* exist with non-ASCII characters in DFS root
> +        * try again with full path (only if nodfs is not set) */
>         if (rc == -ENOENT && is_tcon_dfs(tcon))
>                 rc = cifs_dfs_query_info_nonascii_quirk(xid, tcon, cifs_sb,
>                                                         full_path);
>  #endif
> -       if (rc != 0 && rc != -EREMOTE) {
> -               kfree(full_path);
> -               return rc;
> -       }
> +       if (rc != 0 && rc != -EREMOTE)
> +               goto out;
>
>         if (rc != -EREMOTE) {
>                 rc = cifs_are_all_path_components_accessible(server, xid, tcon,
> @@ -3468,6 +3475,7 @@ static int is_path_remote(struct mount_ctx *mnt_ctx)
>                 }
>         }
>
> +out:
>         kfree(full_path);
>         return rc;
>  }
> --
> 2.36.1
>


-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-20 22:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-18 16:31 [PATCH v2] cifs: don't call cifs_dfs_query_info_nonascii_quirk() if nodfs was set Enzo Matsumiya
2022-05-20 22:41 ` Steve French

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.