All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mkfs.jffs2.c: Fix issue with crashing when using lzo compression
@ 2008-04-15 14:27 Jussi Hakala
  0 siblings, 0 replies; only message in thread
From: Jussi Hakala @ 2008-04-15 14:27 UTC (permalink / raw)
  To: linux-mtd

[-- Attachment #1: Type: text/plain, Size: 352 bytes --]

Calling jffs2_compressors_init() before page_size results in invalid 
compression buffer, which in turn leads to segmentation fault when lzo 
compression is used, for example:

mkfs.jffs2 -r /path-to/mtd-test -o /tmp/mtd-test.jffs2 -e 128KiB -l -n 
-X lzo -x zlib

Thanks to Siarhei Siamashka <siarhei dot siamashka at nokia dot com> for 
the patch.



[-- Attachment #2: lzo-fix.patch --]
[-- Type: text/x-diff, Size: 781 bytes --]

diff -Naur main.d/mtd-utils-0.0~200802271600.orig/mkfs.jffs2.c main.d/mtd-utils-0.0~200802271600/mkfs.jffs2.c
--- main.d/mtd-utils-0.0~200802271600.orig/mkfs.jffs2.c	2008-04-15 14:37:04.000000000 +0300
+++ main.d/mtd-utils-0.0~200802271600/mkfs.jffs2.c	2008-04-15 14:38:51.000000000 +0300
@@ -1662,14 +1662,14 @@
 	int compr_prior  = -1;
 	int warn_page_size = 0;
 
-	jffs2_compressors_init();
-
 	page_size = sysconf(_SC_PAGESIZE);
 	if (page_size < 0) /* System doesn't know so ... */
 		page_size = 4096; /* ... we make an educated guess */
 	if (page_size != 4096)
 		warn_page_size = 1; /* warn user if page size not 4096 */
 
+	jffs2_compressors_init();
+
 	while ((opt = getopt_long(argc, argv,
 					"D:d:r:s:o:qUPfh?vVe:lbp::nc:m:x:X:Lty:i:", long_options, &c)) >= 0)
 	{

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-04-15 14:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-15 14:27 [PATCH] mkfs.jffs2.c: Fix issue with crashing when using lzo compression Jussi Hakala

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.