]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
JFFS2: fix mount crash caused by removed nodes
authorThomas Gleixner <tglx@linutronix.de>
Mon, 16 Feb 2009 20:29:31 +0000 (21:29 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 17 Mar 2009 00:32:02 +0000 (17:32 -0700)
commitcd61ccf550e6ca3e55ba55809d3f51c7e8ef015b
treed2cba5ed9281dc4c1abfa0db044f9c477bd90149
parent5ba885398bb1b2af6ce0a71b832b881337c0a402
JFFS2: fix mount crash caused by removed nodes

commit 4c41bd0ec953954158f92bed5d3062645062b98e upstream.

At scan time we observed following scenario:

   node A inserted
   node B inserted
   node C inserted -> sets overlapped flag on node B

   node A is removed due to CRC failure -> overlapped flag on node B remains

   while (tn->overlapped)
     tn = tn_prev(tn);

   ==> crash, when tn_prev(B) is referenced.

When the ultimate node is removed at scan time and the overlapped flag
is set on the penultimate node, then nothing updates the overlapped
flag of that node. The overlapped iterators blindly expect that the
ultimate node does not have the overlapped flag set, which causes the
scan code to crash.

It would be a huge overhead to go through the node chain on node
removal and fix up the overlapped flags, so detecting such a case on
the fly in the overlapped iterators is a simpler and reliable
solution.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/jffs2/readinode.c