mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-linus
* git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-linus: Squashfs: frag_size should be signed, as it can hold an error result Squashfs: fix documentation typo, Cramfs filesystem limit is 256 MiB Squashfs: Fix oops when reading fsfuzzer corrupted filesystems
This commit is contained in:
commit
d0cdb070ce
6 changed files with 20 additions and 9 deletions
|
@ -22,7 +22,7 @@ Squashfs filesystem features versus Cramfs:
|
|||
|
||||
Squashfs Cramfs
|
||||
|
||||
Max filesystem size: 2^64 16 MiB
|
||||
Max filesystem size: 2^64 256 MiB
|
||||
Max file size: ~ 2 TiB 16 MiB
|
||||
Max files: unlimited unlimited
|
||||
Max directories: unlimited unlimited
|
||||
|
|
|
@ -80,7 +80,7 @@ static struct buffer_head *get_block_length(struct super_block *sb,
|
|||
* generated a larger block - this does occasionally happen with zlib).
|
||||
*/
|
||||
int squashfs_read_data(struct super_block *sb, void **buffer, u64 index,
|
||||
int length, u64 *next_index, int srclength)
|
||||
int length, u64 *next_index, int srclength, int pages)
|
||||
{
|
||||
struct squashfs_sb_info *msblk = sb->s_fs_info;
|
||||
struct buffer_head **bh;
|
||||
|
@ -185,6 +185,14 @@ int squashfs_read_data(struct super_block *sb, void **buffer, u64 index,
|
|||
}
|
||||
|
||||
if (msblk->stream.avail_out == 0) {
|
||||
if (page == pages) {
|
||||
ERROR("zlib_inflate tried to "
|
||||
"decompress too much data, "
|
||||
"expected %d bytes. Zlib "
|
||||
"data probably corrupt\n",
|
||||
srclength);
|
||||
goto release_mutex;
|
||||
}
|
||||
msblk->stream.next_out = buffer[page++];
|
||||
msblk->stream.avail_out = PAGE_CACHE_SIZE;
|
||||
}
|
||||
|
@ -268,7 +276,8 @@ block_release:
|
|||
put_bh(bh[k]);
|
||||
|
||||
read_failure:
|
||||
ERROR("sb_bread failed reading block 0x%llx\n", cur_index);
|
||||
ERROR("squashfs_read_data failed to read block 0x%llx\n",
|
||||
(unsigned long long) index);
|
||||
kfree(bh);
|
||||
return -EIO;
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ struct squashfs_cache_entry *squashfs_cache_get(struct super_block *sb,
|
|||
|
||||
entry->length = squashfs_read_data(sb, entry->data,
|
||||
block, length, &entry->next_index,
|
||||
cache->block_size);
|
||||
cache->block_size, cache->pages);
|
||||
|
||||
spin_lock(&cache->lock);
|
||||
|
||||
|
@ -406,7 +406,7 @@ int squashfs_read_table(struct super_block *sb, void *buffer, u64 block,
|
|||
for (i = 0; i < pages; i++, buffer += PAGE_CACHE_SIZE)
|
||||
data[i] = buffer;
|
||||
res = squashfs_read_data(sb, data, block, length |
|
||||
SQUASHFS_COMPRESSED_BIT_BLOCK, NULL, length);
|
||||
SQUASHFS_COMPRESSED_BIT_BLOCK, NULL, length, pages);
|
||||
kfree(data);
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -133,7 +133,8 @@ int squashfs_read_inode(struct inode *inode, long long ino)
|
|||
type = le16_to_cpu(sqshb_ino->inode_type);
|
||||
switch (type) {
|
||||
case SQUASHFS_REG_TYPE: {
|
||||
unsigned int frag_offset, frag_size, frag;
|
||||
unsigned int frag_offset, frag;
|
||||
int frag_size;
|
||||
u64 frag_blk;
|
||||
struct squashfs_reg_inode *sqsh_ino = &squashfs_ino.reg;
|
||||
|
||||
|
@ -175,7 +176,8 @@ int squashfs_read_inode(struct inode *inode, long long ino)
|
|||
break;
|
||||
}
|
||||
case SQUASHFS_LREG_TYPE: {
|
||||
unsigned int frag_offset, frag_size, frag;
|
||||
unsigned int frag_offset, frag;
|
||||
int frag_size;
|
||||
u64 frag_blk;
|
||||
struct squashfs_lreg_inode *sqsh_ino = &squashfs_ino.lreg;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ static inline struct squashfs_inode_info *squashfs_i(struct inode *inode)
|
|||
|
||||
/* block.c */
|
||||
extern int squashfs_read_data(struct super_block *, void **, u64, int, u64 *,
|
||||
int);
|
||||
int, int);
|
||||
|
||||
/* cache.c */
|
||||
extern struct squashfs_cache *squashfs_cache_init(char *, int, int);
|
||||
|
|
|
@ -389,7 +389,7 @@ static int __init init_squashfs_fs(void)
|
|||
return err;
|
||||
}
|
||||
|
||||
printk(KERN_INFO "squashfs: version 4.0 (2009/01/03) "
|
||||
printk(KERN_INFO "squashfs: version 4.0 (2009/01/31) "
|
||||
"Phillip Lougher\n");
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue