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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHJ8P3LdZXLc2rqeYjvymgYHr2+YLuJ0sLG9DdsJZmwO7deuhw@mail.gmail.com>
Date: Sun, 7 Apr 2024 10:11:02 +0800
From: Zhiguo Niu <niuzhiguo84@...il.com>
To: Chao Yu <chao@...nel.org>
Cc: jaegeuk@...nel.org, linux-kernel@...r.kernel.org, 
	linux-f2fs-devel@...ts.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH 1/2] f2fs: fix to relocate check condition in f2fs_fallocate()

On Wed, Apr 3, 2024 at 10:26 PM Chao Yu <chao@...nel.org> wrote:
>
> compress and pinfile flag should be checked after inode lock held to
> avoid race condition, fix it.
>
> Fixes: 4c8ff7095bef ("f2fs: support data compression")
> Fixes: 5fed0be8583f ("f2fs: do not allow partial truncation on pinned file")
> Signed-off-by: Chao Yu <chao@...nel.org>
> ---
>  fs/f2fs/file.c | 20 +++++++++++---------
>  1 file changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 148bfe3effdf..83a807e25e31 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -1820,15 +1820,6 @@ static long f2fs_fallocate(struct file *file, int mode,
>                 (mode & (FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_INSERT_RANGE)))
>                 return -EOPNOTSUPP;
>
> -       /*
> -        * Pinned file should not support partial truncation since the block
> -        * can be used by applications.
> -        */
> -       if ((f2fs_compressed_file(inode) || f2fs_is_pinned_file(inode)) &&
> -               (mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE |
> -                       FALLOC_FL_ZERO_RANGE | FALLOC_FL_INSERT_RANGE)))
> -               return -EOPNOTSUPP;
> -
>         if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE |
>                         FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE |
>                         FALLOC_FL_INSERT_RANGE))
> @@ -1836,6 +1827,17 @@ static long f2fs_fallocate(struct file *file, int mode,
>
>         inode_lock(inode);
>
> +       /*
> +        * Pinned file should not support partial truncation since the block
> +        * can be used by applications.
> +        */
> +       if ((f2fs_compressed_file(inode) || f2fs_is_pinned_file(inode)) &&
> +               (mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE |
> +                       FALLOC_FL_ZERO_RANGE | FALLOC_FL_INSERT_RANGE))) {
> +               ret = -EOPNOTSUPP;
> +               goto out;
> +       }
> +
Dear Chao,
I see  the judgment code "if(!f2fs_compressed_file(inode))" also is
before inode_lock in functions
f2fs_ioc_decompress_file/f2fs_ioc_compress_file/f2fs_reserve_compress_blocks/f2fs_release_compress_blocks.
should they are changed together?
thanks!
>         ret = file_modified(file);
>         if (ret)
>                 goto out;
> --
> 2.40.1
>
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@...ts.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ