lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJnrk1YL==CtATQYEdA7M-HmpmP9o4ff5Jeg-_oaEa4XruA1Ag@mail.gmail.com>
Date: Wed, 5 Feb 2025 10:13:33 -0800
From: Joanne Koong <joannelkoong@...il.com>
To: Jeff Layton <jlayton@...nel.org>
Cc: Miklos Szeredi <miklos@...redi.hu>, linux-fsdevel@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fuse: don't set file->private_data in fuse_conn_waiting_read

On Tue, Feb 4, 2025 at 7:09 AM Jeff Layton <jlayton@...nel.org> wrote:
>
> I see no reason to set the private_data on the file to this value. Just
> grab the result of the atomic_read() and output it without setting
> private_data.
>
> Signed-off-by: Jeff Layton <jlayton@...nel.org>

Reviewed-by: Joanne Koong <joannelkoong@...il.com>

> ---
>  fs/fuse/control.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/fs/fuse/control.c b/fs/fuse/control.c
> index 2a730d88cc3bdb50ea1f8a3185faad5f05fc6e74..17ef07cf0c38e44bd7eadb3450bd53a8acc5e885 100644
> --- a/fs/fuse/control.c
> +++ b/fs/fuse/control.c
> @@ -49,18 +49,17 @@ static ssize_t fuse_conn_waiting_read(struct file *file, char __user *buf,
>  {
>         char tmp[32];
>         size_t size;
> +       int value;
>

It might be helpful if a "if (*ppos) return -EINVAL;" check gets added here too?


>         if (!*ppos) {
> -               long value;
>                 struct fuse_conn *fc = fuse_ctl_file_conn_get(file);
>                 if (!fc)
>                         return 0;
>
>                 value = atomic_read(&fc->num_waiting);
> -               file->private_data = (void *)value;
>                 fuse_conn_put(fc);
>         }
> -       size = sprintf(tmp, "%ld\n", (long)file->private_data);
> +       size = sprintf(tmp, "%d\n", value);
>         return simple_read_from_buffer(buf, len, ppos, tmp, size);
>  }
>
>
> ---
> base-commit: 9afd7336f3acbe5678cca3b3bc5baefb51ce9564
> change-id: 20250204-fuse-fixes-03882c05c1b1
>
> Best regards,
> --
> Jeff Layton <jlayton@...nel.org>
>
>


>         if (!*ppos) {
> -               long value;
>                 struct fuse_conn *fc = fuse_ctl_file_conn_get(file);
>                 if (!fc)
>                         return 0;
>
>                 value = atomic_read(&fc->num_waiting);
> -               file->private_data = (void *)value;
>                 fuse_conn_put(fc);
>         }
> -       size = sprintf(tmp, "%ld\n", (long)file->private_data);
> +       size = sprintf(tmp, "%d\n", value);
>         return simple_read_from_buffer(buf, len, ppos, tmp, size);
>  }
>
>
> ---
> base-commit: 9afd7336f3acbe5678cca3b3bc5baefb51ce9564
> change-id: 20250204-fuse-fixes-03882c05c1b1
>
> Best regards,
> --
> Jeff Layton <jlayton@...nel.org>
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ