diff options
author | Theodore Ts'o <tytso@mit.edu> | 2010-01-22 17:40:42 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2010-01-22 17:40:42 -0500 |
commit | 1f2acb6017d8528135ec3b01ab7cd2be6ea0630b (patch) | |
tree | 7263a5c1402237166cf425bc8f5336426159622c /include | |
parent | 15121c18a22ae483279f76dc9e554334b800d0f7 (diff) | |
download | linux-1f2acb6017d8528135ec3b01ab7cd2be6ea0630b.tar.gz linux-1f2acb6017d8528135ec3b01ab7cd2be6ea0630b.tar.bz2 linux-1f2acb6017d8528135ec3b01ab7cd2be6ea0630b.zip |
ext4: Add block validity check when truncating indirect block mapped inodes
Add checks to ext4_free_branches() to make sure a block number found
in an indirect block are valid before trying to free it. If a bad
block number is found, stop freeing the indirect block immediately,
since the file system is corrupt and we will need to run fsck anyway.
This also avoids spamming the logs, and specifically avoids
driver-level "attempt to access beyond end of device" errors obscure
what is really going on.
If you get *really*, *really*, *really* unlucky, without this patch, a
supposed indirect block containing garbage might contain a reference
to a primary block group descriptor, in which case
ext4_free_branches() could end up zero'ing out a block group
descriptor block, and if then one of the block bitmaps for a block
group described by that bg descriptor block is not in memory, and is
read in by ext4_read_block_bitmap(). This function calls
ext4_valid_block_bitmap(), which assumes that bg_inode_table() was
validated at mount time and hasn't been modified since. Since this
assumption is no longer valid, it's possible for the value
(ext4_inode_table(sb, desc) - group_first_block) to go negative, which
will cause ext4_find_next_zero_bit() to trigger a kernel GPF.
Addresses-Google-Bug: #2220436
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions