Commit 8f9b54a35a70b604ebd2b2f2e7e04eabd0ff8a54

Authored by Lasse Collin
Committed by Linus Torvalds
1 parent eb0cf3e19b

Decompressors: check for write errors in decompress_unlzo.c

The return value of flush() is not checked in unlzo().  This means that
the decompressor won't stop even if the caller doesn't want more data.
This can happen e.g.  with a corrupt LZO-compressed initramfs image.

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Alain Knaff <alain@knaff.lu>
Cc: Albin Tonnerre <albin.tonnerre@free-electrons.com>
Cc: Phillip Lougher <phillip@lougher.demon.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff

lib/decompress_unlzo.c
... ... @@ -187,8 +187,8 @@
187 187 }
188 188 }
189 189  
190   - if (flush)
191   - flush(out_buf, dst_len);
  190 + if (flush && flush(out_buf, dst_len) != dst_len)
  191 + goto exit_2;
192 192 if (output)
193 193 out_buf += dst_len;
194 194 if (posp)