summaryrefslogtreecommitdiffstats
path: root/fs/sysv
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2010-07-22 03:11:48 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2010-08-11 00:18:43 -0400
commit496ee9b8f349a8ae2065114c414a47e89bdeb930 (patch)
tree4f20840fbaf0016df62be4d7bfc83f4e93c17b4e /fs/sysv
parentb76212d7f19420ab29d86e9d17d1ff36cfe0f922 (diff)
downloadlinux-496ee9b8f349a8ae2065114c414a47e89bdeb930.tar.gz
linux-496ee9b8f349a8ae2065114c414a47e89bdeb930.tar.bz2
linux-496ee9b8f349a8ae2065114c414a47e89bdeb930.zip
V7: Adjust sanity checks for some volumes
Newly mkfs-ed filesystems from Seventh Edition have last modification time set to zero, but are otherwise perfectly valid. Also, tighten up other sanity checks to filter out most filesystems with different bytesex than we're using. Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/sysv')
-rw-r--r--fs/sysv/super.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/sysv/super.c b/fs/sysv/super.c
index 2da3075aff78..5c0aab0b7e18 100644
--- a/fs/sysv/super.c
+++ b/fs/sysv/super.c
@@ -469,7 +469,7 @@ static int v7_fill_super(struct super_block *sb, void *data, int silent)
v7sb = (struct v7_super_block *) bh->b_data;
if (fs16_to_cpu(sbi, v7sb->s_nfree) > V7_NICFREE ||
fs16_to_cpu(sbi, v7sb->s_ninode) > V7_NICINOD ||
- fs32_to_cpu(sbi, v7sb->s_time) == 0)
+ fs32_to_cpu(sbi, v7sb->s_fsize) > V7_MAXSIZE)
goto failed;
/* plausibility check on root inode: it is a directory,
@@ -479,7 +479,9 @@ static int v7_fill_super(struct super_block *sb, void *data, int silent)
v7i = (struct sysv_inode *)(bh2->b_data + 64);
if ((fs16_to_cpu(sbi, v7i->i_mode) & ~0777) != S_IFDIR ||
(fs32_to_cpu(sbi, v7i->i_size) == 0) ||
- (fs32_to_cpu(sbi, v7i->i_size) & 017) != 0)
+ (fs32_to_cpu(sbi, v7i->i_size) & 017) ||
+ (fs32_to_cpu(sbi, v7i->i_size) > V7_NFILES *
+ sizeof (struct sysv_dir_entry)))
goto failed;
brelse(bh2);
bh2 = NULL;