[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <31c6f827-65fa-0fe3-6c98-53be585d818a@linaro.org>
Date: Thu, 14 Jul 2022 06:52:13 -0700
From: Tadeusz Struk <tadeusz.struk@...aro.org>
To: Lukas Czerner <lczerner@...hat.com>
Cc: Theodore Ts'o <tytso@....edu>,
Andreas Dilger <adilger.kernel@...ger.ca>,
linux-ext4@...r.kernel.org, linux-kernel@...r.kernel.org,
syzbot+15cd994e273307bf5cfa@...kaller.appspotmail.com
Subject: Re: [PATCH] ext4: fix kernel BUG in ext4_free_blocks
On 7/14/22 05:23, Lukas Czerner wrote:
>> This does not seem right. we should never work with block number smaller
>> than s_first_data_block. The first 1024 bytes of the file system are
>> unused and in case we have 1k block size, the entire first block is
>> unused.
>>
>> I guess the image we work here with is corrupted, from the log it seems
>> that it was noticed correctly so the question is why did we still ended
>> up calling ext4_free_blocks() ? Seems like this should have been stopped
>> earlier by ext4_clear_blocks() ?
>>
>> I did notice that in ext4_mb_clear_bb() we call
>> ext4_get_group_no_and_offset() before ext4_inode_block_valid() but
>> again we should have caught this problem earlier.
>>
>> Can you link me the file system image that generated this problem?
> ok, I got the syzkaller C repro to work. The problem is that it's
> bigalloc file system and the 'block' and 'count' to free in
> ext4_free_blocks will get adjusted after the ext4_inode_block_valid().
>
> We should make sure that if this happens we also clear the
> EXT4_FREE_BLOCKS_VALIDATED. Additonally the ext4_inode_block_valid()
> in ext4_mb_clear_bb() should be called*before* the values are taken for
> granted. I'll prepare a patch to fix this.
Thank you for feedback Lukas. Please CC me on your patch so I could test it.
--
Thanks,
Tadeusz
Powered by blists - more mailing lists