kernel 3.13.0-157+158: ext4: wrong error message »invalid block bitmap«

Bug #1789435 reported by Jochen Barth on 2018-08-28
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
High
Unassigned

Bug Description

W're getting the »invalid block bitmap« error since kernel 3.13.0-157

see
https://github.com/torvalds/linux/commit/22be37acce25d66ecf6403fc8f44df9c5ded2372

and in this diff the error is within
»if (offset < 0 || EXT4_B2C(sbi, offset) >= sb->s_blocksize ||«

Kind regards, J. Barth

*** linux_3.13.0-155.205.diff 2018-08-28 14:56:04.357521118 +0200
--- linux_3.13.0-157.207.diff 2018-08-28 14:48:27.168863046 +0200
***************
*** 31,37 ****
   }

   /* Return the number of free blocks in a block group. It is used when
! @@ -419,11 +420,15 @@
    }
    ext4_lock_group(sb, block_group);
    if (desc->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
--- 31,102 ----
   }

   /* Return the number of free blocks in a block group. It is used when
! @@ -307,6 +308,7 @@
! ext4_group_t block_group,
! struct buffer_head *bh)
! {
! + struct ext4_sb_info *sbi = EXT4_SB(sb);
! ext4_grpblk_t offset;
! ext4_grpblk_t next_zero_bit;
! ext4_fsblk_t blk;
! @@ -326,24 +328,30 @@
! /* check whether block bitmap block number is set */
! blk = ext4_block_bitmap(sb, desc);
! offset = blk - group_first_block;
! - if (!ext4_test_bit(offset, bh->b_data))
! + if (offset < 0 || EXT4_B2C(sbi, offset) >= sb->s_blocksize ||
! + !ext4_test_bit(EXT4_B2C(sbi, offset), bh->b_data))
! /* bad block bitmap */
! return blk;
!
! /* check whether the inode bitmap block number is set */
! blk = ext4_inode_bitmap(sb, desc);
! offset = blk - group_first_block;
! - if (!ext4_test_bit(offset, bh->b_data))
! + if (offset < 0 || EXT4_B2C(sbi, offset) >= sb->s_blocksize ||
! + !ext4_test_bit(EXT4_B2C(sbi, offset), bh->b_data))
! /* bad block bitmap */
! return blk;
!
! /* check whether the inode table block number is set */
! blk = ext4_inode_table(sb, desc);
! offset = blk - group_first_block;
! + if (offset < 0 || EXT4_B2C(sbi, offset) >= sb->s_blocksize ||
! + EXT4_B2C(sbi, offset + sbi->s_itb_per_group) >= sb->s_blocksize)
! + return blk;
! next_zero_bit = ext4_find_next_zero_bit(bh->b_data,
! - offset + EXT4_SB(sb)->s_itb_per_group,
! - offset);
! - if (next_zero_bit < offset + EXT4_SB(sb)->s_itb_per_group)
! + EXT4_B2C(sbi, offset + EXT4_SB(sb)->s_itb_per_group),
! + EXT4_B2C(sbi, offset));
! + if (next_zero_bit <
! + EXT4_B2C(sbi, offset + EXT4_SB(sb)->s_itb_per_group))
! /* bad bitmap for inode tables */
! return blk;
! return 0;
! @@ -394,6 +402,7 @@
! ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group)
! {
! struct ext4_group_desc *desc;
! + struct ext4_sb_info *sbi = EXT4_SB(sb);
! struct buffer_head *bh;
! ext4_fsblk_t bitmap_blk;
!
! @@ -401,6 +410,12 @@
! if (!desc)
! return NULL;
! bitmap_blk = ext4_block_bitmap(sb, desc);
! + if ((bitmap_blk <= le32_to_cpu(sbi->s_es->s_first_data_block)) ||
! + (bitmap_blk >= ext4_blocks_count(sbi->s_es))) {
! + ext4_error(sb, "Invalid block bitmap block %llu in "
! + "block_group %u", bitmap_blk, block_group);
! + return ERR_PTR(-EIO);
! + }
! bh = sb_getblk(sb, bitmap_blk);
! if (unlikely(!bh)) {
! ext4_error(sb, "Cannot get buffer for block bitmap - "
! @@ -419,11 +434,15 @@
    }
    ext4_lock_group(sb, block_group);
    if (desc->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {

This bug is missing log files that will aid in diagnosing the problem. While running an Ubuntu kernel (not a mainline or third-party kernel) please enter the following command in a terminal window:

apport-collect 1789435

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
Changed in linux (Ubuntu):
importance: Undecided → High
Brad Figg (brad-figg) on 2019-07-24
tags: added: cscc
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers