Skip to content

Commit 9442e54

Browse files
committed
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: Bob Copeland <me@bobcopeland.com>
1 parent f068272 commit 9442e54

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎fs/omfs/inode.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,15 @@ static int omfs_fill_super(struct super_block *sb, void *data, int silent)
509509
goto out_brelse_bh2;
510510
}
511511

512+
if (sbi->s_bitmap_ino != ~0ULL &&
513+
sbi->s_bitmap_ino > sbi->s_num_blocks) {
514+
printk(KERN_ERR "omfs: free space bitmap location is corrupt "
515+
"(%llx, total blocks %llx)\n",
516+
(unsigned long long) sbi->s_bitmap_ino,
517+
(unsigned long long) sbi->s_num_blocks);
518+
goto out_brelse_bh2;
519+
}
520+
512521
ret = omfs_get_imap(sb);
513522
if (ret)
514523
goto out_brelse_bh2;

0 commit comments

Comments
 (0)