1. 20 Nov, 2013 2 commits
    • Phillip Lougher's avatar
      Squashfs: Generalise paging handling in the decompressors · 846b730e
      Phillip Lougher authored
      Further generalise the decompressors by adding a page handler
      abstraction.  This adds helpers to allow the decompressors
      to access and process the output buffers in an implementation
      independant manner.
      
      This allows different types of output buffer to be passed
      to the decompressors, with the implementation specific
      aspects handled at decompression time, but without the
      knowledge being held in the decompressor wrapper code.
      
      This will allow the decompressors to handle Squashfs
      cache buffers, and page cache pages.
      
      This patch adds the abstraction and an implementation for
      the caches.
      Signed-off-by: 's avatarPhillip Lougher <phillip@squashfs.org.uk>
      Reviewed-by: 's avatarMinchan Kim <minchan@kernel.org>
      846b730e
    • Phillip Lougher's avatar
      Squashfs: Refactor decompressor interface and code · 9508c6b9
      Phillip Lougher authored
      The decompressor interface and code was written from
      the point of view of single-threaded operation.  In doing
      so it mixed a lot of single-threaded implementation specific
      aspects into the decompressor code and elsewhere which makes it
      difficult to seamlessly support multiple different decompressor
      implementations.
      
      This patch does the following:
      
      1.  It removes compressor_options parsing from the decompressor
          init() function.  This allows the decompressor init() function
          to be dynamically called to instantiate multiple decompressors,
          without the compressor options needing to be read and parsed each
          time.
      
      2.  It moves threading and all sleeping operations out of the
          decompressors.  In doing so, it makes the decompressors
          non-blocking wrappers which only deal with interfacing with
          the decompressor implementation.
      
      3. It splits decompressor.[ch] into decompressor generic functions
         in decompressor.[ch], and moves the single threaded
         decompressor implementation into decompressor_single.c.
      
      The result of this patch is Squashfs should now be able to
      support multiple decompressors by adding new decompressor_xxx.c
      files with specialised implementations of the functions in
      decompressor_single.c
      Signed-off-by: 's avatarPhillip Lougher <phillip@squashfs.org.uk>
      Reviewed-by: 's avatarMinchan Kim <minchan@kernel.org>
      9508c6b9
  2. 04 Sep, 2013 1 commit
  3. 10 Mar, 2012 1 commit
  4. 26 May, 2011 1 commit
  5. 26 Jan, 2011 1 commit
    • Phillip Lougher's avatar
      squashfs: fix use of uninitialised variable in zlib & xz decompressors · 3689456b
      Phillip Lougher authored
      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: 's avatarPhillip Lougher <phillip@lougher.demon.co.uk>
      Reported-by: 's avatarJesper Juhl <jj@chaosbits.net>
      Signed-off-by: 's avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: 's avatarLinus Torvalds <torvalds@linux-foundation.org>
      3689456b
  6. 13 Jan, 2011 1 commit
  7. 25 Apr, 2010 1 commit
  8. 20 Jan, 2010 3 commits
  9. 12 Mar, 2009 1 commit
    • Phillip Lougher's avatar
      Squashfs: Valid filesystems are flagged as bad by the corrupted fs patch · 363911d0
      Phillip Lougher authored
      The corrupted filesystem patch added a check against zlib trying to
      output too much data in the presence of data corruption.  This check
      triggered if zlib_inflate asked to be called again (Z_OK) with
      avail_out == 0 and no more output buffers available.  This check proves
      to be rather dumb, as it incorrectly catches the case where zlib has
      generated all the output, but there are still input bytes to be processed.
      
      This patch does a number of things.  It removes the original check and
      replaces it with code to not move to the next output buffer if there
      are no more output buffers available, relying on zlib to error if it
      wants an extra output buffer in the case of data corruption.  It
      also replaces the Z_NO_FLUSH flag with the more correct Z_SYNC_FLUSH
      flag, and makes the error messages more understandable to
      non-technical users.
      Signed-off-by: 's avatarPhillip Lougher <phillip@lougher.demon.co.uk>
      Reported-by: 's avatarStefan Lippers-Hollmann <s.L-H@gmx.de>
      363911d0
  10. 05 Mar, 2009 1 commit
  11. 05 Jan, 2009 1 commit