mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefan Lippers-Hollmann <s.L-H@gmx.de>
To: Phillip Lougher <phillip@lougher.demon.co.uk>
Cc: Phillip Lougher <phil.lougher@gmail.com>,
	Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>,
	Linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [GIT PULL] Squashfs fixes for 2.6.29?
Date: Wed, 11 Mar 2009 21:46:50 +0100	[thread overview]
Message-ID: <200903112146.54280.s.L-H@gmx.de> (raw)
In-Reply-To: <49B75666.5030106@lougher.demon.co.uk>

Hi

On Mittwoch, 11. März 2009, Phillip Lougher wrote:
> Phillip Lougher wrote:
[...]
> The following patch fixes the problems you've experienced with your test
> filesystems (thanks for making them available), and also deals with the corrupted
> filesystems issue.  It correctly works with all the corrupted filesystems sent
> earlier this year.
> 
> The problem arises due to an unexpected corner-case with zlib which the
> corrupted filesystems patch didn't address.  Very occasionally zlib exits
> needing a couple of extra bytes of input (1 and 2 bytes in the test filesystems),
> but with avail_out == 0 and no more output buffers available.  This situation
> was incorrectly flagged as an error by the corrupted filesystems patch. I
> unfortunately didn't anticipate this scenario because it seems contrary to
> expectation that zlib will be still reading input having produced all the
> expected output.  The fix is to not print an error if zlib wants more input
> bytes and there's more input bytes to be read.

I just got home and around to test it with 2.6.29-rc7-git4, no further 
issues with large filesystems (copying + live usage) and it's working 
reliably (after whitespace fixing), thank you a lot. 

> Geert I can put a signed off line from you on the patch if you like (as you
> sent the original fix).  I could add reported and tested lines from both of you?
> They seem to be being used more often and sound a good idea.

Feel free to add the tags as needed, thanks.
Reported-by: Stefan Lippers-Hollmann <s.L-H@gmx.de>
Tested-by: Stefan Lippers-Hollmann <s.L-H@gmx.de>

> Thanks
> 
> Phillip

Regards
	Stefan Lippers-Hollmann

-- 
> diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c
> index 321728f..b85173f 100644
> --- a/fs/squashfs/block.c
> +++ b/fs/squashfs/block.c
> @@ -166,6 +166,22 @@ int squashfs_read_data(struct super_block *sb, void **buffer, u64 index,
> 
>   		bytes = length;
>   		do {
> +			if (msblk->stream.avail_out == 0) {
> +				if (page < pages) {
> +					msblk->stream.next_out = buffer[page++];
> +					msblk->stream.avail_out =
> +								PAGE_CACHE_SIZE;
> +				} else if (msblk->stream.avail_in > 0
> +								|| bytes == 0) {
> +					ERROR("zlib_inflate tried to "
> +						"decompress too much data, "
> +						"expected %d bytes.  Zlib "
> +						"data probably corrupt\n",
> +						srclength);
> +					goto release_mutex;
> +				}
> +			}
> +
>   			if (msblk->stream.avail_in == 0 && k < b) {
>   				avail = min(bytes, msblk->devblksize - offset);
>   				bytes -= avail;
> @@ -184,19 +200,6 @@ int squashfs_read_data(struct super_block *sb, void **buffer, u64 index,
>   				offset = 0;
>   			}
> 
> -			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;
> -			}
> -
>   			if (!zlib_init) {
>   				zlib_err = zlib_inflateInit(&msblk->stream);
>   				if (zlib_err != Z_OK) {

  parent reply	other threads:[~2009-03-11 20:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-05  1:54 Phillip Lougher
2009-03-09 21:39 ` Stefan Lippers-Hollmann
2009-03-10  2:13   ` Phillip Lougher
2009-03-10 11:02     ` Geert Uytterhoeven
2009-03-10 13:19       ` Woody Suwalski
2009-03-10 21:24       ` Stefan Lippers-Hollmann
2009-03-10 21:33       ` Phillip Lougher
2009-03-11  6:12         ` Phillip Lougher
2009-03-11 14:18           ` Geert Uytterhoeven
2009-03-11 20:46           ` Stefan Lippers-Hollmann [this message]
2009-03-10 20:02     ` Stefan Lippers-Hollmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200903112146.54280.s.L-H@gmx.de \
    --to=s.l-h@gmx.de \
    --cc=Geert.Uytterhoeven@sonycom.com \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=phil.lougher@gmail.com \
    --cc=phillip@lougher.demon.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome