All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [MTD] JFFS2: Missing verify buffer allocation/deallocation.
@ 2009-08-27  8:44 massimo cirillo
  2009-09-01  8:48 ` Artem Bityutskiy
  0 siblings, 1 reply; 2+ messages in thread
From: massimo cirillo @ 2009-08-27  8:44 UTC (permalink / raw)
  To: linux-mtd

From: Massimo Cirillo <maxcir@gmail.com>

The function jffs2_nor_wbuf_flash_setup() doesn't allocate the verify buffer
if CONFIG_JFFS2_FS_WBUF_VERIFY is defined, so causing a kernel panic when
that macro is enabled and the verify function is called. Similarly the
jffs2_nor_wbuf_flash_cleanup() must free the buffer if
CONFIG_JFFS2_FS_WBUF_VERIFY is enabled.
The following patch fixes the problem.
The following patch applies to 2.6.30 kernel.

Signed-off-by: Massimo Cirillo <maxcir@gmail.com>
---
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
old mode 100644
new mode 100755
index d9a721e..5ef7bac
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -1268,10 +1268,20 @@ int jffs2_nor_wbuf_flash_setup(struct
jffs2_sb_info *c) {
 	if (!c->wbuf)
 		return -ENOMEM;

+#ifdef CONFIG_JFFS2_FS_WBUF_VERIFY
+	c->wbuf_verify = kmalloc(c->wbuf_pagesize, GFP_KERNEL);
+	if (!c->wbuf_verify) {
+		kfree(c->wbuf);
+		return -ENOMEM;
+	}
+#endif
 	return 0;
 }

 void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c) {
+#ifdef CONFIG_JFFS2_FS_WBUF_VERIFY
+	kfree(c->wbuf_verify);
+#endif
 	kfree(c->wbuf);
 }

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-09-01  8:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-27  8:44 [PATCH] [MTD] JFFS2: Missing verify buffer allocation/deallocation massimo cirillo
2009-09-01  8:48 ` Artem Bityutskiy

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.