diff mbox series

NFS: add a tracepoint for uniquifier of fscache

Message ID 20240305034122.172-1-chenhx.fnst@fujitsu.com (mailing list archive)
State New
Headers show
Series NFS: add a tracepoint for uniquifier of fscache | expand

Commit Message

Chen Hanxiao March 5, 2024, 3:41 a.m. UTC
Add a tracepoint to the mount fsc=xxx option

Signed-off-by: Chen Hanxiao <chenhx.fnst@fujitsu.com>
---
 fs/nfs/fs_context.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Trond Myklebust March 5, 2024, 3:28 p.m. UTC | #1
On Tue, 2024-03-05 at 11:41 +0800, Chen Hanxiao wrote:
> [You don't often get email from chenhx.fnst@fujitsu.com. Learn why
> this is important at https://aka.ms/LearnAboutSenderIdentification ]
> 
> Add a tracepoint to the mount fsc=xxx option
> 
> Signed-off-by: Chen Hanxiao <chenhx.fnst@fujitsu.com>
> ---
>  fs/nfs/fs_context.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/nfs/fs_context.c b/fs/nfs/fs_context.c
> index 853e8d609bb3..fd8813222cd2 100644
> --- a/fs/nfs/fs_context.c
> +++ b/fs/nfs/fs_context.c
> @@ -652,6 +652,9 @@ static int nfs_fs_context_parse_param(struct
> fs_context *fc,
>                 ctx->fscache_uniq = NULL;
>                 break;
>         case Opt_fscache:
> +               if (!param->string)
> +                       goto out_invalid_value;
> +               trace_nfs_mount_assign(param->key, param->string);

The description does not match the contents of the patch. Why would we
need that extra check on top of the ones made by fs_param_is_string()?

>                 ctx->options |= NFS_OPTION_FSCACHE;
>                 kfree(ctx->fscache_uniq);
>                 ctx->fscache_uniq = param->string;
> --
> 2.39.1
>
Chen Hanxiao March 6, 2024, 4:07 a.m. UTC | #2
> -----邮件原件-----
> 发件人: Trond Myklebust <trondmy@hammerspace.com>
> 发送时间: 2024年3月5日 23:28
> 收件人: anna@kernel.org; 
> 抄送: linux-nfs@vger.kernel.org; jlayton@kernel.org
> 主题: Re: [PATCH] NFS: add a tracepoint for uniquifier of fscache
> 
> On Tue, 2024-03-05 at 11:41 +0800, Chen Hanxiao wrote:
> > [You don't often get email from chenhx.fnst@fujitsu.com. Learn why
> > this is important at https://aka.ms/LearnAboutSenderIdentification ]
> >
> > Add a tracepoint to the mount fsc=xxx option
> >
> > Signed-off-by: Chen Hanxiao <chenhx.fnst@fujitsu.com>
> > ---
> >  fs/nfs/fs_context.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/fs/nfs/fs_context.c b/fs/nfs/fs_context.c
> > index 853e8d609bb3..fd8813222cd2 100644
> > --- a/fs/nfs/fs_context.c
> > +++ b/fs/nfs/fs_context.c
> > @@ -652,6 +652,9 @@ static int nfs_fs_context_parse_param(struct
> > fs_context *fc,
> >                 ctx->fscache_uniq = NULL;
> >                 break;
> >         case Opt_fscache:
> > +               if (!param->string)
> > +                       goto out_invalid_value;
> > +               trace_nfs_mount_assign(param->key, param->string);
> 
> The description does not match the contents of the patch. Why would we
> need that extra check on top of the ones made by fs_param_is_string()?
> 

I take 5559405df652 ("nfs: fix possible null-ptr-deref when parsing param") for reference.
Maybe I misunderstand that fix.
I'll post a v2 without the null check, and with a proper description about commit message.

Regards,
- Chen
diff mbox series

Patch

diff --git a/fs/nfs/fs_context.c b/fs/nfs/fs_context.c
index 853e8d609bb3..fd8813222cd2 100644
--- a/fs/nfs/fs_context.c
+++ b/fs/nfs/fs_context.c
@@ -652,6 +652,9 @@  static int nfs_fs_context_parse_param(struct fs_context *fc,
 		ctx->fscache_uniq = NULL;
 		break;
 	case Opt_fscache:
+		if (!param->string)
+			goto out_invalid_value;
+		trace_nfs_mount_assign(param->key, param->string);
 		ctx->options |= NFS_OPTION_FSCACHE;
 		kfree(ctx->fscache_uniq);
 		ctx->fscache_uniq = param->string;