Re: [PATCH] cifs: sanitize paths in cifs_update_super_prepath.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thiago Becker <tbecker@xxxxxxxxxx> writes:

> After a server reboot, clients are failing to move files with ENOENT.
> This is caused by DFS referrals containing multiple separators, which
> the server move call doesn't recognize.
>
> BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=2182472
> Fixes: a31080899d5f ("cifs: sanitize multiple delimiters in prepath")
> Actually-Fixes: 24e0a1eff9e2 ("cifs: switch to new mount api")
> Signed-off-by: Thiago Rafael Becker <tbecker@xxxxxxxxxx>
> ---
>  fs/cifs/fs_context.c | 6 +++---
>  fs/cifs/misc.c       | 4 +++-
>  2 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/fs/cifs/fs_context.c b/fs/cifs/fs_context.c
> index 6d13f8207e96a..c4d9139b89d29 100644
> --- a/fs/cifs/fs_context.c
> +++ b/fs/cifs/fs_context.c
> @@ -445,7 +445,7 @@ int smb3_parse_opt(const char *options, const char *key, char **val)
>   * cleaning up the original.
>   */
>  #define IS_DELIM(c) ((c) == '/' || (c) == '\\')
> -static char *sanitize_path(char *path)
> +char *sanitize_path(char *path, gfp_t gfp)

Could you please add a {cifs,smb3}_ prefix to it?

>  {
>  	char *cursor1 = path, *cursor2 = path;
>  
> @@ -469,7 +469,7 @@ static char *sanitize_path(char *path)
>  		cursor2--;
>  
>  	*(cursor2) = '\0';
> -	return kstrdup(path, GFP_KERNEL);
> +	return kstrdup(path, gfp);
>  }
>  
>  /*
> @@ -531,7 +531,7 @@ smb3_parse_devname(const char *devname, struct smb3_fs_context *ctx)
>  	if (!*pos)
>  		return 0;
>  
> -	ctx->prepath = sanitize_path(pos);
> +	ctx->prepath = sanitize_path(pos, GFP_KERNEL);
>  	if (!ctx->prepath)
>  		return -ENOMEM;
>  
> diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
> index b44fb51968bfb..e6f208110de83 100644
> --- a/fs/cifs/misc.c
> +++ b/fs/cifs/misc.c
> @@ -1190,12 +1190,14 @@ int match_target_ip(struct TCP_Server_Info *server,
>  	return 0;
>  }
>  
> +extern char *sanitize_path(char *path, gfp_t gfp);

Please do the above in fs/cifs/fs_context.h.

Otherwise, looks good to me.

Reviewed-by: Paulo Alcantara (SUSE) <pc@xxxxxxxxxxxxx>



[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux