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: <CAL3q7H7rWHsWrkwywymXeoqt-Ah0V4Y4JtzdVzMCDxTY0-Tk0w@mail.gmail.com>
Date: Thu, 6 Nov 2025 12:07:35 +0000
From: Filipe Manana <fdmanana@...nel.org>
To: Zilin Guan <zilin@....edu.cn>
Cc: clm@...com, dsterba@...e.com, fdmanana@...e.com, neal@...pa.dev, 
	boris@....io, linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org, 
	jianhao.xu@....edu.cn
Subject: Re: [PATCH] btrfs: avoid redundant cleanup when device allocation fails

On Thu, Nov 6, 2025 at 12:03 PM Zilin Guan <zilin@....edu.cn> wrote:
>
> When device allocation fails, the chunk map has not been added to the
> mapping tree, so locking for cleanup is unnecessary. Simply free the
> chunk map as done when adding it to the mapping tree fails.
>
> Fixes: bf2e2eb060fa2 ("btrfs: Add self-tests for btrfs_rmap_block")

Seriously? How is this a bug?

It's fine as it is, it may be not optimal due to extra locking and
such, but this is an error path which should be rare, plus it's in the
self tests that run only when the module is loaded (needs
CONFIG_BTRFS_FS_RUN_SANITY_TESTS=y).

It's an unnecessary patch.


> Signed-off-by: Zilin Guan <zilin@....edu.cn>
> ---
>  fs/btrfs/tests/extent-map-tests.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/tests/extent-map-tests.c b/fs/btrfs/tests/extent-map-tests.c
> index 42af6c737c6e..e227cfff1e8d 100644
> --- a/fs/btrfs/tests/extent-map-tests.c
> +++ b/fs/btrfs/tests/extent-map-tests.c
> @@ -1036,7 +1036,8 @@ static int test_rmap_block(struct btrfs_fs_info *fs_info,
>                 if (IS_ERR(dev)) {
>                         test_err("cannot allocate device");
>                         ret = PTR_ERR(dev);
> -                       goto out;
> +                       btrfs_free_chunk_map(map);
> +                       goto out_free;
>                 }
>                 map->stripes[i].dev = dev;
>                 map->stripes[i].physical = test->data_stripe_phys_start[i];
> --
> 2.34.1
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ