Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Paulo Alcantara <pc@manguebit.com>
To: Thiago Becker <tbecker@redhat.com>,
	sfrench@samba.org, linux-cifs@vger.kernel.org
Cc: lsahlber@redhat.com, sprasad@microsoft.com, tom@talpey.com,
	trbecker@gmail.com, samba-technical@lists.samba.org,
	Thiago Becker <tbecker@redhat.com>
Subject: Re: [PATCH] cifs: sanitize paths in cifs_update_super_prepath.
Date: Tue, 04 Apr 2023 16:54:55 -0300	[thread overview]
Message-ID: <c4e73fa0c44827c31bdec7c22f4e05df.pc@manguebit.com> (raw)
In-Reply-To: <20230404185908.993738-1-tbecker@redhat.com>

Thiago Becker <tbecker@redhat.com> 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@redhat.com>
> ---
>  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@manguebit.com>

  reply	other threads:[~2023-04-04 19:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-04 18:59 [PATCH] cifs: sanitize paths in cifs_update_super_prepath Thiago Becker
2023-04-04 19:54 ` Paulo Alcantara [this message]
2023-04-04 21:34 ` kernel test robot
2023-04-04 22:26 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c4e73fa0c44827c31bdec7c22f4e05df.pc@manguebit.com \
    --to=pc@manguebit.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=lsahlber@redhat.com \
    --cc=samba-technical@lists.samba.org \
    --cc=sfrench@samba.org \
    --cc=sprasad@microsoft.com \
    --cc=tbecker@redhat.com \
    --cc=tom@talpey.com \
    --cc=trbecker@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox