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: <CAL3q7H62btgspnDRUvRp7Xv17TPdzUae7JzrHLvaLYpR-N43hA@mail.gmail.com>
Date:   Fri, 5 Mar 2021 11:28:10 +0000
From:   Filipe Manana <fdmanana@...il.com>
To:     Jia-Ju Bai <baijiaju1990@...il.com>
Cc:     Chris Mason <clm@...com>, Josef Bacik <josef@...icpanda.com>,
        David Sterba <dsterba@...e.com>,
        linux-btrfs <linux-btrfs@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] fs: btrfs: fix error return code of btrfs_recover_relocation()

On Fri, Mar 5, 2021 at 9:46 AM Jia-Ju Bai <baijiaju1990@...il.com> wrote:
>
> When the list of reloc_roots is empty, no error return code of
> btrfs_recover_relocation() is assigned.
> To fix this bug, err is assigned with -ENOENT as error return code.

No, there isn't any such bug.

If there are no reloc roots, it means there's no relocation to resume,
in which case err is already 0 and we therefore return 0.
By setting err to -ENOENT, that will cause a mount failure on any fs
that does not have relocation to resume.

You could have tested this simply by doing:

$ mkfs.btrfs -f /dev/sdc
$ mount /dev/sdc /mnt/sdc
mount: /mnt/sdc: mount(2) system call failed: No such file or directory.

It's always a good idea to test patches, even if we are very
comfortable with the code they are touching...

Thanks.


>
> Reported-by: TOTE Robot <oslab@...nghua.edu.cn>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.com>
> ---
>  fs/btrfs/relocation.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
> index 232d5da7b7be..631b672a852f 100644
> --- a/fs/btrfs/relocation.c
> +++ b/fs/btrfs/relocation.c
> @@ -3817,8 +3817,10 @@ int btrfs_recover_relocation(struct btrfs_root *root)
>         }
>         btrfs_release_path(path);
>
> -       if (list_empty(&reloc_roots))
> +       if (list_empty(&reloc_roots)) {
> +               err = -ENOENT;
>                 goto out;
> +       }
>
>         rc = alloc_reloc_control(fs_info);
>         if (!rc) {
> --
> 2.17.1
>


-- 
Filipe David Manana,

“Whether you think you can, or you think you can't — you're right.”

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ