[BUGFIX] JFFS2 NOR problem

Artem B. Bityuckiy dedekind at infradead.org
Sat Feb 26 14:19:53 EST 2005


Hello,

I've detected major JFFS2 bug and have attached the fix. The bug seems
to be NOR-only. I believe everybody who uses JFFS2 on top of NOR flash
should have this bug fixed.

The brief problem description:

JFFS2 clears the JFFS2_SB_FLAG_MOUNTING (c-flags) superblock flag after
it has done the 1st filesystem build pass. But it still has non NULL
ic->scan_dents pointers which are actually assigned NULL at the very end
of the file system build procedure. Next FS build passes call the
jffs2_mark_node_obsolete() function which, in turn, utilizes the
jffs2_raw_ref_to_ic() function which *requires* ic->scan_dents = NULL.

This might cause infinite loops and oopses.

I think it is safe to clear the JFFS2_SB_FLAG_MOUNTING flag at the end
of JFFS2 filesystem build routine. Comments?

P.S. Possibly, the patch will fix Konstantin Kletschke's and Craig A.
Vanderborgh's problems. Guys, please try.



--- build.c     2005-02-26 22:08:17.503657749 +0300
+++ build.c_fixed       2005-02-26 22:07:55.806278357 +0300
@@ -116,7 +116,6 @@
                        cond_resched();
                }
        }
-       c->flags &= ~JFFS2_SB_FLAG_MOUNTING;

        D1(printk(KERN_DEBUG "Pass 1 complete\n"));

@@ -164,6 +163,8 @@
                ic->scan_dents = NULL;
                cond_resched();
        }
+       c->flags &= ~JFFS2_SB_FLAG_MOUNTING;
+
        D1(printk(KERN_DEBUG "Pass 3 complete\n"));
        D2(jffs2_dump_block_lists(c));


-- 
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.





More information about the linux-mtd mailing list