squashfs: read uncompressed blocks through the backend framework
Subsystems (2)
PATCH 1/1 squashfs: read uncompressed blocks through the backend framework
Avoid double free on the temporary decompression hack-path; this may leak buffer heads if decompression exits early.
--- fs/squashfs/backend.h | 4 +- fs/squashfs/bdev.c | 191 ++++++++++++++++++++++++++++++++++++++---- fs/squashfs/block.c | 167 ++++++++----------------------------- fs/squashfs/lzma_wrapper.c | 2 + fs/squashfs/squashfs_fs_sb.h | 2 - fs/squashfs/super.c | 5 +- 6 files changed, 216 insertions(+), 155 deletions(-)
fs/squashfs/backend.h +2 -2
@@ -4,9 +4,9 @@#include "squashfs_fs_sb.h" struct squashfs_backend { -void *(*init)(struct squashfs_sb_info *,u64 ,size_t ); +int (*init)(struct super_block *,u64 ,int ,int ,u64 *,int *);void (*free)(struct squashfs_sb_info *); -ssize_t (*read)(struct squashfs_sb_info *,void **,size_t ); +int (*read)(struct super_block *,void *,int );int (*probe)(struct file_system_type *,int ,const char *,void *,struct vfsmount *);void (*killsb)(struct super_block *);
fs/squashfs/bdev.c +174 -17
243 lines not on this page · raw message
fs/squashfs/block.c +36 -131
197 lines not on this page · raw message
fs/squashfs/lzma_wrapper.c +2 -0
@@ -94,6 +94,8 @@ static int lzma_uncompress(struct squashfs_sb_info *msblk, void **buffer,void *buff = stream->input;int avail, i, bytes = length, res; +TRACE ("lzma_uncompress: bh=%p, b=%d, offset=%d, length=%d, srclength=%d," +" pages=%d\n" , bh, b, offset, length, srclength, pages);mutex_lock (&lzma_mutex);for (i =0 ; i < b; i++) {
fs/squashfs/squashfs_fs_sb.h +0 -2
@@ -55,8 +55,6 @@ struct squashfs_sb_info {const struct squashfs_decompressor *decompressor;const struct squashfs_backend *backend;void *backend_data; -int devblksize; -int devblksize_log2;struct squashfs_cache *block_cache;struct squashfs_cache *fragment_cache;struct squashfs_cache *read_page;
fs/squashfs/super.c +2 -3
@@ -87,7 +87,7 @@ int squashfs_fill_super(struct super_block *sb, void *data, int silent,u64 lookup_table_start;int err; -TRACE ("Entered squashfs_fill_superblock\n" ); +TRACE ("Entered squashfs_fill_superblock, silent=%d\n" , silent); sb->s_fs_info =kzalloc (sizeof (*msblk),GFP_KERNEL );if (sb->s_fs_info ==NULL ) {
@@ -103,8 +103,6 @@ int squashfs_fill_super(struct super_block *sb, void *data, int silent, goto free_msblk; } - msblk->devblksize =sb_min_blocksize (sb,BLOCK_SIZE ); - msblk->devblksize_log2 =ffz (~msblk->devblksize); err =add_backend (sb);if (err) goto free_sblk;
@@ -305,6 +303,7 @@ failed_mount:kfree (msblk->inode_lookup_table);/* FIXME: squashfs_put_super has meta_index instead */ kfree (msblk->fragment_index);kfree (msblk->id_table); +TRACE ("squasfs_fill_super: killing backend, err=%d\n" , err); msblk->backend->kill (msblk); free_sblk:kfree (sblk);
Signature · 1 line
1.5.6.5