From: Lasse Collin Date: Thu, 13 Jan 2011 01:01:20 +0000 (-0800) Subject: Decompressors: check for write errors in decompress_unlzo.c X-Git-Tag: v2.6.38-rc1~255 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8f9b54a35a70b604ebd2b2f2e7e04eabd0ff8a54;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git 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 Cc: "H. Peter Anvin" Cc: Alain Knaff Cc: Albin Tonnerre Cc: Phillip Lougher Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/lib/decompress_unlzo.c b/lib/decompress_unlzo.c index 6e56d54..855d9d3 100644 --- a/lib/decompress_unlzo.c +++ b/lib/decompress_unlzo.c @@ -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)