Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9442e54f authored by Bob Copeland's avatar Bob Copeland
Browse files

omfs: refuse to mount if bitmap pointer is obviously wrong



If the free space bitmap pointer is corrupted such that it lies outside
of the number of blocks in the filesystem, print a message and fail the
mount so the user can fix it offline.

Signed-off-by: default avatarBob Copeland <me@bobcopeland.com>
parent f068272c
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -509,6 +509,15 @@ static int omfs_fill_super(struct super_block *sb, void *data, int silent)
		goto out_brelse_bh2;
		goto out_brelse_bh2;
	}
	}


	if (sbi->s_bitmap_ino != ~0ULL &&
	    sbi->s_bitmap_ino > sbi->s_num_blocks) {
		printk(KERN_ERR "omfs: free space bitmap location is corrupt "
			"(%llx, total blocks %llx)\n",
			(unsigned long long) sbi->s_bitmap_ino,
			(unsigned long long) sbi->s_num_blocks);
		goto out_brelse_bh2;
	}

	ret = omfs_get_imap(sb);
	ret = omfs_get_imap(sb);
	if (ret)
	if (ret)
		goto out_brelse_bh2;
		goto out_brelse_bh2;