Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 208881
b: refs/heads/master
c: 496ee9b
h: refs/heads/master
i:
  208879: 093ae00
v: v3
  • Loading branch information
Lubomir Rintel authored and Al Viro committed Aug 11, 2010
1 parent f3b599f commit 1d17dde
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b76212d7f19420ab29d86e9d17d1ff36cfe0f922
refs/heads/master: 496ee9b8f349a8ae2065114c414a47e89bdeb930
6 changes: 4 additions & 2 deletions trunk/fs/sysv/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down
11 changes: 11 additions & 0 deletions trunk/include/linux/sysv_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,17 @@ struct v7_super_block {
char s_fname[6]; /* file system name */
char s_fpack[6]; /* file system pack name */
};
/* Constants to aid sanity checking */
/* This is not a hard limit, nor enforced by v7 kernel. It's actually just
* the limit used by Seventh Edition's ls, though is high enough to assume
* that no reasonable file system would have that much entries in root
* directory. Thus, if we see anything higher, we just probably got the
* endiannes wrong. */
#define V7_NFILES 1024
/* The disk addresses are three-byte (despite direct block addresses being
* aligned word-wise in inode). If the most significant byte is non-zero,
* something is most likely wrong (not a filesystem, bad bytesex). */
#define V7_MAXSIZE 0x00ffffff

/* Coherent super-block data on disk */
#define COH_NICINOD 100 /* number of inode cache entries */
Expand Down

0 comments on commit 1d17dde

Please sign in to comment.