summaryrefslogtreecommitdiff
path: root/lib/decompress_unlzo.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2011-01-12 17:01:20 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-13 08:03:24 -0800
commit8f9b54a35a70b604ebd2b2f2e7e04eabd0ff8a54 (patch)
treec71b832a9c1c571c00dba35b39b5b94d03764c2d /lib/decompress_unlzo.c
parenteb0cf3e19b4940a2d26dcdea03510ae16a580fcd (diff)
downloadkernel-common-8f9b54a35a70b604ebd2b2f2e7e04eabd0ff8a54.tar.gz
kernel-common-8f9b54a35a70b604ebd2b2f2e7e04eabd0ff8a54.tar.bz2
kernel-common-8f9b54a35a70b604ebd2b2f2e7e04eabd0ff8a54.zip
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>
Diffstat (limited to 'lib/decompress_unlzo.c')
-rw-r--r--lib/decompress_unlzo.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/decompress_unlzo.c b/lib/decompress_unlzo.c
index 6e56d547ba32..855d9d30ec45 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)