summaryrefslogtreecommitdiffstats
path: root/fs/squashfs
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'squashfs-updates' of ↵Linus Torvalds2012-03-285-24/+15
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-next Pull squashfs updates from Phillip Lougher: "Add an extra mount time sanity check, plus some code cleanups and bug fixes." * tag 'squashfs-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-next: Squashfs: add mount time sanity check for block_size and block_log match Squashfs: fix f_pos check in get_dir_index_using_offset Squashfs: get rid of obsolete definitions in header file Squashfs: remove redundant length initialisation in squashfs_lookup Squashfs: remove redundant length initialisation in squashfs_readdir Squashfs: update comment removing reference to zlib only Squashfs: use define instead of constant
| * Squashfs: add mount time sanity check for block_size and block_log matchPhillip Lougher2012-03-101-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Squashfs currently has a sanity check for block_size less than or equal to the maximum block_size (1 Mbyte). This catches some superblock corruption, but obviously with a block_size maximum of 1 Mbyte there's 7 correct values (4K, 8K, 16K, 32K, ... etc) and a lot of incorrect values which are not caught by this check. The Squashfs superblock, however, has both a block_size and a block_log (2^block_log == block_size). Checking that the block_size matches the block_log is a much more robust check. Corruption of the superblock is unlikely to produce values which match, and it also ensures the block_size is an exact power of two. Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
| * Squashfs: fix f_pos check in get_dir_index_using_offsetPhillip Lougher2012-03-101-1/+1
| | | | | | | | | | | | | | | | | | | | One off error in the f_pos check. If f_pos is 3 or less don't bother reading the index because we're at the start of the directory, and we obviously already know where that is on disk. This eliminates an unnecessary read. Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
| * Squashfs: get rid of obsolete definitions in header filePhillip Lougher2012-03-101-16/+0
| | | | | | | | | | | | | | | | Most of these were never used by the kernel code, but belong to the time when the header file was used by both the kernel code and the user space tools. Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
| * Squashfs: remove redundant length initialisation in squashfs_lookupPhillip Lougher2012-03-101-1/+1
| | | | | | | | Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
| * Squashfs: remove redundant length initialisation in squashfs_readdirPhillip Lougher2012-03-101-1/+1
| | | | | | | | Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
| * Squashfs: update comment removing reference to zlib onlyPhillip Lougher2012-03-101-1/+2
| | | | | | | | | | | | | | | | Comment was written when Squashfs only supported zlib compression. This comment is now misleading given Squashfs supports other compression algorithms. Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
| * Squashfs: use define instead of constantAjeet Yadav2012-03-103-4/+5
| | | | | | | | | | | | | | Its better to use defined name instead of constant Signed-off-by: Ajeet Yadav <ajeet.yadav.77@gmail.com> Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
* | Merge branch 'for-linus' of ↵Linus Torvalds2012-03-211-2/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs Pull vfs pile 1 from Al Viro: "This is _not_ all; in particular, Miklos' and Jan's stuff is not there yet." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (64 commits) ext4: initialization of ext4_li_mtx needs to be done earlier debugfs-related mode_t whack-a-mole hfsplus: add an ioctl to bless files hfsplus: change finder_info to u32 hfsplus: initialise userflags qnx4: new helper - try_extent() qnx4: get rid of qnx4_bread/qnx4_getblk take removal of PF_FORKNOEXEC to flush_old_exec() trim includes in inode.c um: uml_dup_mmap() relies on ->mmap_sem being held, but activate_mm() doesn't hold it um: embed ->stub_pages[] into mmu_context gadgetfs: list_for_each_safe() misuse ocfs2: fix leaks on failure exits in module_init ecryptfs: make register_filesystem() the last potential failure exit ntfs: forgets to unregister sysctls on register_filesystem() failure logfs: missing cleanup on register_filesystem() failure jfs: mising cleanup on register_filesystem() failure make configfs_pin_fs() return root dentry on success configfs: configfs_create_dir() has parent dentry in dentry->d_parent configfs: sanitize configfs_create() ...
| * | switch open-coded instances of d_make_root() to new helperAl Viro2012-03-201-2/+1
| |/ | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | squashfs: remove the second argument of k[un]map_atomic()Cong Wang2012-03-202-6/+6
|/ | | | Signed-off-by: Cong Wang <amwang@redhat.com>
* Merge git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-nextLinus Torvalds2012-01-134-12/+25
|\ | | | | | | | | | | | | | | | | * git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-next: Squashfs: fix i_blocks calculation with extended regular files Squashfs: fix mount time sanity check for corrupted superblock Squashfs: optimise squashfs_cache_get entry search Squashfs: Update documentation to include xattrs Squashfs: add missing block release on error condition
| * Squashfs: fix i_blocks calculation with extended regular filesPhillip Lougher2012-01-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The le64_to_cpu() forces the calculation to be unsigned, with the effect that it can underflow leading to an incorrect large value. This bug only triggers in rare(ish) circumstances, an empty file encoded as an extended regular file or a completely sparse file. Normally empty files are encoded as a regular file rather than as an extended regular file (and the regular file i_blocks calculation doesn't have this bug). To save space regular file inodes are optimised to encode the most commonly occurring files. Less common regular files are encoded using extended regular file inodes which contain extra information. Empty files with nlinks greater than 1, and or empty files with extended attributes are encoded using extended regular file inodes and they will hit this bug. Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
| * Squashfs: fix mount time sanity check for corrupted superblockPhillip Lougher2012-01-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | A Squashfs filesystem containing nothing but an empty directory, although unusual and ultimately pointless, is still valid. The directory_table >= next_table sanity check rejects these filesystems as invalid because the directory_table is empty and equal to next_table. Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
| * Squashfs: optimise squashfs_cache_get entry searchAjeet Yadav2011-12-302-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | squashfs_cache_get() iterates over all entries to search for block its looking for. Often get() / put() are called for same block. If we cache the current entry index, then we can optimise the subsequent *_get() calls. Signed-off-by: Ajeet Yadav <ajeet.yadav.77@gmail.com> Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
| * Squashfs: add missing block release on error conditionPhillip Lougher2011-12-301-6/+13
| | | | | | | | | | | | | | squashfs_read_metadata forgets to release the cache block if an error has occurred. Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
* | vfs: fix the stupidity with i_dentry in inode destructorsAl Viro2012-01-031-1/+0
|/ | | | | | | | | | Seeing that just about every destructor got that INIT_LIST_HEAD() copied into it, there is no point whatsoever keeping this INIT_LIST_HEAD in inode_init_once(); the cost of taking it into inode_init_always() will be negligible for pipes and sockets and negative for everything else. Not to mention the removal of boilerplate code from ->destroy_inode() instances... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* Merge git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-nextLinus Torvalds2011-11-043-1/+30
|\ | | | | | | | | * git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-next: Squashfs: Add an option to set dev block size to 4K
| * Squashfs: Add an option to set dev block size to 4KPhillip Lougher2011-11-023-1/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds an option to set the device block size used to 4K. By default Squashfs sets the device block size (sb_min_blocksize) to 1K or the smallest block size supported by the block device (if larger). This, because blocks are packed together and unaligned in Squashfs, should reduce latency. This, however, gives poor performance on MTD NAND devices where the optimal I/O size is 4K (even though the devices can support smaller block sizes). Using a 4K device block size may also improve overall I/O performance for some file access patterns (e.g. sequential accesses of files in filesystem order) on all media. Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
* | filesystems: add set_nlink()Miklos Szeredi2011-11-021-9/+9
| | | | | | | | | | | | | | | | | | Replace remaining direct i_nlink updates with a new set_nlink() updater function. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Tested-by: Toshiyuki Okajima <toshi.okajima@jp.fujitsu.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
* | doc: fix broken referencesPaul Bolle2011-09-271-3/+3
|/ | | | | | | | | | | | | There are numerous broken references to Documentation files (in other Documentation files, in comments, etc.). These broken references are caused by typo's in the references, and by renames or removals of the Documentation files. Some broken references are simply odd. Fix these broken references, sometimes by dropping the irrelevant text they were part of. Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* Merge git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-linusLinus Torvalds2011-07-255-5/+25
|\ | | | | | | | | | | * git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-linus: Squashfs: Make ZLIB compression support optional Squashfs: Update documentation for XZ and add squashfs-tools devel tree
| * Squashfs: Make ZLIB compression support optionalPhillip Lougher2011-07-225-5/+25
| | | | | | | | | | | | | | | | | | Squashfs now supports XZ and LZO compression in addition to ZLIB. As such it no longer makes sense to always include ZLIB support. In particular embedded systems may only use LZO or XZ compression, and the ability to exclude ZLIB support will reduce kernel size. Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
* | make d_splice_alias(ERR_PTR(err), dentry) = ERR_PTR(err)Al Viro2011-07-201-5/+0
| | | | | | | | | | | | ... and simplify the living hell out of callers Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | deuglify squashfs_lookup()Al Viro2011-07-201-4/+1
|/ | | | | | | | d_splice_alias(NULL, dentry) is equivalent to d_add(dentry, NULL), NULL so no need for that if (inode) ... in there (or ERR_PTR(0), for that matter) Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* Merge git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-linusLinus Torvalds2011-05-294-6/+6
|\ | | | | | | | | * git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-linus: Squashfs: Fix sanity check patches on big-endian systems
| * Squashfs: Fix sanity check patches on big-endian systemsPhillip Lougher2011-05-294-6/+6
| | | | | | | | | | | | | | le64 values should be swapped when accessing on big-endian systems. Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
* | Merge git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-linusLinus Torvalds2011-05-2622-150/+202
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | * git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-linus: Squashfs: update email address Squashfs: add extra sanity checks at mount time Squashfs: add sanity checks to fragment reading at mount time Squashfs: add sanity checks to lookup table reading at mount time Squashfs: add sanity checks to id reading at mount time Squashfs: add sanity checks to xattr reading at mount time Squashfs: reverse order of filesystem table reading Squashfs: move table allocation into squashfs_read_table()
| * Squashfs: update email addressPhillip Lougher2011-05-2622-23/+23
| | | | | | | | | | | | | | My existing email address may stop working in a month or two, so update email to one that will continue working. Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
| * Squashfs: add extra sanity checks at mount timePhillip Lougher2011-05-251-2/+16
| | | | | | | | | | | | Add some extra sanity checks of the inode and directory structures. Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
| * Squashfs: add sanity checks to fragment reading at mount timePhillip Lougher2011-05-253-4/+25
| | | | | | | | | | | | | | | | | | | | | | | | Fsfuzzer generates corrupted filesystems which throw a warn_on in kmalloc. One of these is due to a corrupted superblock fragments field. Fix this by checking that the number of bytes to be read (and allocated) does not extend into the next filesystem structure. Also add a couple of other sanity checks of the mount-time fragment table structures. Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
| * Squashfs: add sanity checks to lookup table reading at mount timePhillip Lougher2011-05-253-4/+30
| | | | | | | | | | | | | | | | | | | | | | | | Fsfuzzer generates corrupted filesystems which throw a warn_on in kmalloc. One of these is due to a corrupted superblock inodes field. Fix this by checking that the number of bytes to be read (and allocated) does not extend into the next filesystem structure. Also add a couple of other sanity checks of the mount-time lookup table structures. Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
| * Squashfs: add sanity checks to id reading at mount timePhillip Lougher2011-05-254-6/+37
| | | | | | | | | | | | | | | | | | | | | | | | Fsfuzzer generates corrupted filesystems which throw a warn_on in kmalloc. One of these is due to a corrupted superblock no_ids field. Fix this by checking that the number of bytes to be read (and allocated) does not extend into the next filesystem structure. Also add a couple of other sanity checks of the mount-time id table structures. Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
| * Squashfs: add sanity checks to xattr reading at mount timePhillip Lougher2011-05-251-0/+11
| | | | | | | | | | | | These checks add sanity checking of the mount-time xattr structures. Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
| * Squashfs: reverse order of filesystem table readingPhillip Lougher2011-05-251-34/+37
| | | | | | | | | | | | | | | | Reverse order of table reading from mostly first to last in placement order, to last to first. This is to enable extra superblock sanity checks to be added in later patches. Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
| * Squashfs: move table allocation into squashfs_read_table()Phillip Lougher2011-05-257-98/+44
| | | | | | | | | | | | This eliminates a lot of duplicate code. Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
* | treewide: fix a few typos in commentsJustin P. Mattock2011-05-102-3/+3
| | | | | | | | | | | | | | | | | | | | - kenrel -> kernel - whetehr -> whether - ttt -> tt - sss -> ss Signed-off-by: Justin P. Mattock <justinmattock@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | Fix common misspellingsLucas De Marchi2011-03-311-2/+2
|/ | | | | | Fixes generated by 'codespell' and manually reviewed. Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
* Squashfs: Use vmalloc rather than kmalloc for zlib workspacePhillip Lougher2011-03-221-3/+3
| | | | | | | | | Bugzilla bug 31422 reports occasional "page allocation failure. order:4" at Squashfs mount time. Fix this by making zlib workspace allocation use vmalloc rather than kmalloc. Reported-by: Mehmet Giritli <mehmet@giritli.eu> Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
* Squashfs: handle corruption of directory structurePhillip Lougher2011-03-162-0/+21
| | | | | | | | | | | | | | | | | | Handle the rare case where a directory metadata block is uncompressed and corrupted, leading to a kernel oops in directory scanning (memcpy). Normally corruption is detected at the decompression stage and dealt with then, however, this will not happen if: - metadata isn't compressed (users can optionally request no metadata compression), or - the compressed metadata block was larger than the original, in which case the uncompressed version was used, or - the data was corrupt after decompression This patch fixes this by adding some sanity checks against known maximum values. Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
* Squashfs: wrap squashfs_mount() definitionPhillip Lougher2011-02-281-2/+2
| | | | | | | Squashfs_get_sb() to squashfs_mount() conversion (commit 152a0836) results in line over 80 characters. Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
* Squashfs: xz_wrapper doesn't need to include squashfs_fs_i.h anymorePhillip Lougher2011-02-281-1/+0
| | | | Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
* Squashfs: Update Kconfig help text to include xz compressionPhillip Lougher2011-02-281-6/+6
| | | | Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
* Squashfs: add compression options support to xz decompressorPhillip Lougher2011-02-281-8/+41
| | | | | | | | Pass the dictionary size used to compress datablocks. Using a dictionary size less than the block size saves memory overhead, in many cases without adversely affecting compression ratio. Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
* Squashfs: extend decompressor framework to handle compression optionsPhillip Lougher2011-02-288-16/+54
| | | | | | | | | | | | | | | | Extend decompressor framework to handle compression options stored in the filesystem. These options can be used by the relevant decompressor at initialisation time to over-ride defaults. The presence of compression options in the filesystem is indicated by the COMP_OPT filesystem flag. If present the data is read from the filesystem and passed to the decompressor init function. The decompressor init function signature has been extended to take this data. Also update the init function signature in the glib, lzo and xz decompressor wrappers. Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
* squashfs: fix use of uninitialised variable in zlib & xz decompressorsPhillip Lougher2011-01-263-12/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix potential use of uninitialised variable caused by recent decompressor code optimisations. In zlib_uncompress (zlib_wrapper.c) we have int zlib_err, zlib_init = 0; ... do { ... if (avail == 0) { offset = 0; put_bh(bh[k++]); continue; } ... zlib_err = zlib_inflate(stream, Z_SYNC_FLUSH); ... } while (zlib_err == Z_OK); If continue is executed (avail == 0) then the while condition will be evaluated testing zlib_err, which is uninitialised first time around the loop. Fix this by getting rid of the 'if (avail == 0)' condition test, this edge condition should not be being handled in the decompressor code, and instead handle it generically in the caller code. Similarly for xz_wrapper.c. Incidentally, on most architectures (bar Mips and Parisc), no uninitialised variable warning is generated by gcc, this is because the while condition test on continue is optimised out and not performed (when executing continue zlib_err has not been changed since entering the loop, and logically if the while condition was true previously, then it's still true). Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk> Reported-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Squashfs: simplify CONFIG_SQUASHFS_LZO handlingPhillip Lougher2011-01-133-9/+6
| | | | | | | Get rid of messy repeated #if(n)def CONFIG_SQUASHFS_LZO code in decompressor.c Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
* Squashfs: move squashfs_i() definition from squashfs.hPhillip Lougher2011-01-1310-13/+6
| | | | | | | Move squashfs_i() definition out of squashfs.h, this eliminates the need to #include squashfs_fs_i.h from numerous files. Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
* Squashfs: get rid of default n in KconfigPhillip Lougher2011-01-131-3/+0
| | | | | | | As pointed out by Geert Uytterhoeven, "default n" is the default, no reason to specify it. Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
* Squashfs: add missing check in zlib_wrapperPhillip Lougher2011-01-131-0/+5
| | | | | | | On file system corruption zlib can return Z_STREAM_OK with input buffers remaining, which will not be released. Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
OpenPOWER on IntegriCloud