[PATCH 1/3] Decompressors: Check for write errors in decompress_unlzo.c

From: Lasse Collin
Date: Tue Nov 23 2010 - 14:57:30 EST


From: Lasse Collin <lasse.collin@xxxxxxxxxxx>

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@xxxxxxxxxxx>
---

--- linux-2.6.37-rc3/lib/decompress_unlzo.c.orig 2010-10-20 23:30:22.000000000 +0300
+++ linux-2.6.37-rc3/lib/decompress_unlzo.c 2010-11-23 12:57:46.000000000 +0200
@@ -190,8 +190,8 @@ STATIC inline int INIT unlzo(u8 *input,
}
}

- 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)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/