Decompressors: check for write errors in decompress_unlzo.c
authorLasse Collin <[email protected]>
Thu, 13 Jan 2011 01:01:20 +0000 (17:01 -0800)
committerLinus Torvalds <[email protected]>
Thu, 13 Jan 2011 16:03:24 +0000 (08:03 -0800)
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 <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Alain Knaff <[email protected]>
Cc: Albin Tonnerre <[email protected]>
Cc: Phillip Lougher <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
lib/decompress_unlzo.c

index 6e56d547ba32849666cbb1abc2a2f7e194fee1d5..855d9d30ec4577300a128bf5d17f4f5c380362af 100644 (file)
@@ -187,8 +187,8 @@ STATIC inline int INIT unlzo(u8 *input, int in_len,
                        }
                }
 
-               if (flush)
-                       flush(out_buf, dst_len);
+               if (flush && flush(out_buf, dst_len) != dst_len)
+                       goto exit_2;
                if (output)
                        out_buf += dst_len;
                if (posp)