aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorBob Copeland <me@bobcopeland.com>2008-08-14 18:43:59 -0400
committerBob Copeland <me@bobcopeland.com>2010-07-10 14:37:39 -0400
commit9442e54f433eff9b6fbd0836611df4c1919df370 (patch)
tree5740987b7a7fcb1511263435fbbf48cf15ff0814 /fs
parentf068272cb2f134a194b93e94a8e0672bfce48cd8 (diff)
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/omfs/inode.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c
index bd4bf753a63b..0af5d0af9f32 100644
--- a/fs/omfs/inode.c
+++ b/fs/omfs/inode.c
@@ -509,6 +509,15 @@ static int omfs_fill_super(struct super_block *sb, void *data, int silent)
509 goto out_brelse_bh2; 509 goto out_brelse_bh2;
510 } 510 }
511 511
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
512 ret = omfs_get_imap(sb); 521 ret = omfs_get_imap(sb);
513 if (ret) 522 if (ret)
514 goto out_brelse_bh2; 523 goto out_brelse_bh2;