summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2010-08-10 18:03:33 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-11 08:59:22 -0700
commit0bcaa65a56ab74003666cf741b0bfa1e9263a11c (patch)
tree580445e4f38cf6894ff695069edcc048b09870dd /fs
parenta36517e9302b8396db24600bf9f67e4d1c441907 (diff)
downloadlinux-3.10-0bcaa65a56ab74003666cf741b0bfa1e9263a11c.tar.gz
linux-3.10-0bcaa65a56ab74003666cf741b0bfa1e9263a11c.tar.bz2
linux-3.10-0bcaa65a56ab74003666cf741b0bfa1e9263a11c.zip
fs/sysv: 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 [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Lubomir Rintel <lkundrak@v3.sk> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-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 2da3075aff7..3785262b98e 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;