[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d409289e-bfb5-48a1-87b5-f25b5b9c9502@gmx.com>
Date: Thu, 24 Oct 2024 07:37:55 +1030
From: Qu Wenruo <quwenruo.btrfs@....com>
To: Edward Adam Davis <eadavis@...com>,
syzbot+5d2b33d7835870519b5f@...kaller.appspotmail.com
Cc: clm@...com, dsterba@...e.com, josef@...icpanda.com,
linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org,
syzkaller-bugs@...glegroups.com
Subject: Re: [PATCH] btrfs: add a sanity check for csum root before fill the
data csum
在 2024/10/23 21:34, Edward Adam Davis 写道:
> Syzbot reported a null-ptr-deref in btrfs_lookup_csums_bitmap.
> The btrfs info contains IGNOREDATACSUMS, which prevents the csum root from
> being loaded.
> Before filling in the csum data, check the flag BTRFS_FS_STATE_NO_DATA_CSUMS
> to confirm that the csum root has been loaded.
>
> Reported-and-tested-by: syzbot+5d2b33d7835870519b5f@...kaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=5d2b33d7835870519b5f
> Signed-off-by: Edward Adam Davis <eadavis@...com>
Reviewed-by: Qu Wenruo <wqu@...e.com>
Thanks,
Qu
> ---
> fs/btrfs/scrub.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
> index 3a3427428074..1ba4d8ba902b 100644
> --- a/fs/btrfs/scrub.c
> +++ b/fs/btrfs/scrub.c
> @@ -1602,7 +1602,8 @@ static int scrub_find_fill_first_stripe(struct btrfs_block_group *bg,
> }
>
> /* Now fill the data csum. */
> - if (bg->flags & BTRFS_BLOCK_GROUP_DATA) {
> + if (!test_bit(BTRFS_FS_STATE_NO_DATA_CSUMS, &fs_info->fs_state) &&
> + bg->flags & BTRFS_BLOCK_GROUP_DATA) {
> int sector_nr;
> unsigned long csum_bitmap = 0;
>
Powered by blists - more mailing lists