aboutsummaryrefslogtreecommitdiffstats
path: root/fs/squashfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/squashfs')
-rw-r--r--fs/squashfs/dir.c3
-rw-r--r--fs/squashfs/namei.c3
-rw-r--r--fs/squashfs/squashfs_fs.h3
3 files changed, 5 insertions, 4 deletions
diff --git a/fs/squashfs/dir.c b/fs/squashfs/dir.c
index 9dfe2ce0fb70..4a812bfcdd5e 100644
--- a/fs/squashfs/dir.c
+++ b/fs/squashfs/dir.c
@@ -173,8 +173,7 @@ static int squashfs_readdir(struct file *file, void *dirent, filldir_t filldir)
173 173
174 dir_count = le32_to_cpu(dirh.count) + 1; 174 dir_count = le32_to_cpu(dirh.count) + 1;
175 175
176 /* dir_count should never be larger than 256 */ 176 if (dir_count > SQUASHFS_DIR_COUNT)
177 if (dir_count > 256)
178 goto failed_read; 177 goto failed_read;
179 178
180 while (dir_count--) { 179 while (dir_count--) {
diff --git a/fs/squashfs/namei.c b/fs/squashfs/namei.c
index 0682b38d7e31..66c70fc8c80b 100644
--- a/fs/squashfs/namei.c
+++ b/fs/squashfs/namei.c
@@ -177,8 +177,7 @@ static struct dentry *squashfs_lookup(struct inode *dir, struct dentry *dentry,
177 177
178 dir_count = le32_to_cpu(dirh.count) + 1; 178 dir_count = le32_to_cpu(dirh.count) + 1;
179 179
180 /* dir_count should never be larger than 256 */ 180 if (dir_count > SQUASHFS_DIR_COUNT)
181 if (dir_count > 256)
182 goto data_error; 181 goto data_error;
183 182
184 while (dir_count--) { 183 while (dir_count--) {
diff --git a/fs/squashfs/squashfs_fs.h b/fs/squashfs/squashfs_fs.h
index e8e14645de9a..b2f9f623ac98 100644
--- a/fs/squashfs/squashfs_fs.h
+++ b/fs/squashfs/squashfs_fs.h
@@ -52,6 +52,9 @@
52/* Max length of filename (not 255) */ 52/* Max length of filename (not 255) */
53#define SQUASHFS_NAME_LEN 256 53#define SQUASHFS_NAME_LEN 256
54 54
55/* Max value for directory header count*/
56#define SQUASHFS_DIR_COUNT 256
57
55#define SQUASHFS_INVALID_FRAG (0xffffffffU) 58#define SQUASHFS_INVALID_FRAG (0xffffffffU)
56#define SQUASHFS_INVALID_XATTR (0xffffffffU) 59#define SQUASHFS_INVALID_XATTR (0xffffffffU)
57#define SQUASHFS_INVALID_BLK (-1LL) 60#define SQUASHFS_INVALID_BLK (-1LL)