All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jussi Hakala <jussi.hakala@hut.fi>
To: linux-mtd@lists.infradead.org
Subject: [PATCH] mkfs.jffs2.c: Fix issue with crashing when using lzo compression
Date: Tue, 15 Apr 2008 17:27:12 +0300	[thread overview]
Message-ID: <4804BB40.9080403@hut.fi> (raw)

[-- 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)
 	{

                 reply	other threads:[~2008-04-15 14:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4804BB40.9080403@hut.fi \
    --to=jussi.hakala@hut.fi \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.